diff --git a/MVMCoreUI/BaseControllers/MFScrollingViewController.m b/MVMCoreUI/BaseControllers/MFScrollingViewController.m index f6e2c4d3..5486b54a 100644 --- a/MVMCoreUI/BaseControllers/MFScrollingViewController.m +++ b/MVMCoreUI/BaseControllers/MFScrollingViewController.m @@ -93,7 +93,7 @@ static NSTimeInterval const HandScrollAnimationTiming = 7.f; BOOL automaticInset = NO; if (@available(iOS 11.0, *)) { - automaticInset = self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic; + automaticInset = self.navigationController && self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic; } // Takes into account the navigation bar. diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 7f34de85..5509ca33 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -881,7 +881,7 @@ CGFloat const PanelAnimationDuration = 0.2; return self.topAlertView.statusBarStyle; } else { UIStatusBarStyle style = [self getDefaultStatusBarStyle]; - [self.topAlertView resetDefaultStatusBarStyle:style backgroundColor:[self getDefaultStatusBarBackgroundColor]]; + [self.topAlertView resetDefaultBackgroundColor:[self getDefaultStatusBarBackgroundColor] basedOnStatusBarStyle:[self getDefaultStatusBarStyle]]; return style; } } diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h index ac5219b0..04f8bc73 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h @@ -41,8 +41,8 @@ - (void)expandStatusBarView; - (void)collapseStatusBarView; -//reset status bar color to default based on splitview -- (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(nullable UIColor *)backgroundColor; +//reset status bar background color based on style +- (void)resetDefaultBackgroundColor:(nullable UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style; // Can be subclassed for custom views. - (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id )animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor; diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index 6753e67c..0b1045a6 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -204,8 +204,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; completionHandler(finished); weakSelf.topAlertObject = nil; [MVMCoreDispatchUtility performBlockOnMainThread:^{ - MVMCoreUISplitViewController *mainsplit = [MVMCoreUISplitViewController mainSplitViewController]; - [weakSelf resetDefaultStatusBarStyle:[mainsplit getDefaultStatusBarStyle] backgroundColor:[mainsplit getDefaultStatusBarBackgroundColor]]; + [weakSelf setStatusBarColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault]; }]; }]; }]; @@ -245,15 +244,15 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; }]; } -- (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(UIColor *)backgroundColor { +- (void)resetDefaultBackgroundColor:(UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style { UIColor *defaultStatusBarBackgroundColor = backgroundColor; if (!defaultStatusBarBackgroundColor) { defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; } if (!self.topAlertObject) { - //style or color doens't match the current default value - if (style != self.statusBarStyle || !CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { - [self setStatusBarColor:defaultStatusBarBackgroundColor statusBarStyle:style]; + //color doens't match the current default value + if (!CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { + self.statusBarView.backgroundColor = defaultStatusBarBackgroundColor; } } }