add override status bar function
This commit is contained in:
parent
67ac36383b
commit
9278ad75ea
@ -30,6 +30,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
// View Controller can override this method and do custom action instead of opening the left panel
|
// View Controller can override this method and do custom action instead of opening the left panel
|
||||||
- (BOOL)isOverridingLeftButton;
|
- (BOOL)isOverridingLeftButton;
|
||||||
|
|
||||||
|
//return desired status bar style based on different View Controller
|
||||||
|
- (UIStatusBarStyle)panelPreferredStatusBarStyle;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@ -105,6 +105,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
|||||||
+ (CGFloat)getApplicationViewWidth;
|
+ (CGFloat)getApplicationViewWidth;
|
||||||
+ (CGFloat)getApplicationViewMaxSize;
|
+ (CGFloat)getApplicationViewMaxSize;
|
||||||
|
|
||||||
|
// return subviewcontrollers' prefer status bar style
|
||||||
|
- (UIStatusBarStyle)getDefaultStatusBarStyle;
|
||||||
|
|
||||||
#pragma mark - Main Subclassables
|
#pragma mark - Main Subclassables
|
||||||
|
|
||||||
// Can subclass to set threshold for when the drawers are permanently extended. Default is 1000 for the left panel and 2000 for both.
|
// Can subclass to set threshold for when the drawers are permanently extended. Default is 1000 for the left panel and 2000 for both.
|
||||||
|
|||||||
@ -877,7 +877,25 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (UIStatusBarStyle)preferredStatusBarStyle {
|
- (UIStatusBarStyle)preferredStatusBarStyle {
|
||||||
return self.topAlertView.statusBarStyle;
|
if (self.topAlertView.topAlertObject) {
|
||||||
|
return self.topAlertView.statusBarStyle;
|
||||||
|
} else {
|
||||||
|
UIStatusBarStyle style = [self getDefaultStatusBarStyle];
|
||||||
|
if (self.topAlertView.statusBarStyle != style) {
|
||||||
|
[self.topAlertView resetStatusBar];
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIStatusBarStyle)getDefaultStatusBarStyle {
|
||||||
|
UIViewController *viewController = [self getCurrentDetailViewController];
|
||||||
|
if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]
|
||||||
|
&& [viewController respondsToSelector:@selector(panelPreferredStatusBarStyle)]
|
||||||
|
&& [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) panelPreferredStatusBarStyle]) {
|
||||||
|
return [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) panelPreferredStatusBarStyle];
|
||||||
|
}
|
||||||
|
return UIStatusBarStyleDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Getters
|
#pragma mark - Getters
|
||||||
|
|||||||
@ -41,6 +41,9 @@
|
|||||||
- (void)expandStatusBarView;
|
- (void)expandStatusBarView;
|
||||||
- (void)collapseStatusBarView;
|
- (void)collapseStatusBarView;
|
||||||
|
|
||||||
|
//reset status bar color to default based on splitview
|
||||||
|
- (void)resetStatusBar;
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
|
|||||||
@ -189,7 +189,6 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
|
|||||||
[weakSelf.superview layoutIfNeeded];
|
[weakSelf.superview layoutIfNeeded];
|
||||||
} completion:^(BOOL finished) {
|
} completion:^(BOOL finished) {
|
||||||
[weakSelf.animationDelegate topAlertViewFinishAnimation];
|
[weakSelf.animationDelegate topAlertViewFinishAnimation];
|
||||||
[weakSelf setStatusBarColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault];
|
|
||||||
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
|
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
|
||||||
|
|
||||||
UIView *view = weakSelf.currentAlert;
|
UIView *view = weakSelf.currentAlert;
|
||||||
@ -204,6 +203,9 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
|
|||||||
[operation markAsFinished];
|
[operation markAsFinished];
|
||||||
completionHandler(finished);
|
completionHandler(finished);
|
||||||
weakSelf.topAlertObject = nil;
|
weakSelf.topAlertObject = nil;
|
||||||
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
|
[weakSelf resetStatusBar];
|
||||||
|
}];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
@ -242,4 +244,10 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)resetStatusBar {
|
||||||
|
UIStatusBarStyle style = [[MVMCoreUISplitViewController mainSplitViewController] getDefaultStatusBarStyle];
|
||||||
|
UIColor *backgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor];
|
||||||
|
[self setStatusBarColor:backgroundColor statusBarStyle:style];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user