only change the status bar background color

This commit is contained in:
panxi 2019-04-17 11:17:44 -04:00
parent c1fe2c617d
commit a254e7d882
4 changed files with 9 additions and 10 deletions

View File

@ -93,7 +93,7 @@ static NSTimeInterval const HandScrollAnimationTiming = 7.f;
BOOL automaticInset = NO; BOOL automaticInset = NO;
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
automaticInset = self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic; automaticInset = self.navigationController && self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic;
} }
// Takes into account the navigation bar. // Takes into account the navigation bar.

View File

@ -881,7 +881,7 @@ CGFloat const PanelAnimationDuration = 0.2;
return self.topAlertView.statusBarStyle; return self.topAlertView.statusBarStyle;
} else { } else {
UIStatusBarStyle style = [self getDefaultStatusBarStyle]; UIStatusBarStyle style = [self getDefaultStatusBarStyle];
[self.topAlertView resetDefaultStatusBarStyle:style backgroundColor:[self getDefaultStatusBarBackgroundColor]]; [self.topAlertView resetDefaultBackgroundColor:[self getDefaultStatusBarBackgroundColor] basedOnStatusBarStyle:[self getDefaultStatusBarStyle]];
return style; return style;
} }
} }

View File

@ -41,8 +41,8 @@
- (void)expandStatusBarView; - (void)expandStatusBarView;
- (void)collapseStatusBarView; - (void)collapseStatusBarView;
//reset status bar color to default based on splitview //reset status bar background color based on style
- (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(nullable UIColor *)backgroundColor; - (void)resetDefaultBackgroundColor:(nullable UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style;
// Can be subclassed for custom views. // Can be subclassed for custom views.
- (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor; - (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor;

View File

@ -204,8 +204,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
completionHandler(finished); completionHandler(finished);
weakSelf.topAlertObject = nil; weakSelf.topAlertObject = nil;
[MVMCoreDispatchUtility performBlockOnMainThread:^{ [MVMCoreDispatchUtility performBlockOnMainThread:^{
MVMCoreUISplitViewController *mainsplit = [MVMCoreUISplitViewController mainSplitViewController]; [weakSelf setStatusBarColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault];
[weakSelf resetDefaultStatusBarStyle:[mainsplit getDefaultStatusBarStyle] backgroundColor:[mainsplit getDefaultStatusBarBackgroundColor]];
}]; }];
}]; }];
}]; }];
@ -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; UIColor *defaultStatusBarBackgroundColor = backgroundColor;
if (!defaultStatusBarBackgroundColor) { if (!defaultStatusBarBackgroundColor) {
defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor];
} }
if (!self.topAlertObject) { if (!self.topAlertObject) {
//style or color doens't match the current default value //color doens't match the current default value
if (style != self.statusBarStyle || !CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { if (!CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) {
[self setStatusBarColor:defaultStatusBarBackgroundColor statusBarStyle:style]; self.statusBarView.backgroundColor = defaultStatusBarBackgroundColor;
} }
} }
} }