Commit 3d1a48df authored by yuzheng.tz's avatar yuzheng.tz

优化状态栏的处理逻辑

parent 4282dfd0
......@@ -107,9 +107,12 @@
- (void)signleTapAction {
_toolBar.hidden = !_toolBar.isHidden;
[self.navigationController setNavigationBarHidden:_toolBar.isHidden];
if (!TZ_isGlobalHideStatusBar) {
if (iOS7Later) [UIApplication sharedApplication].statusBarHidden = _toolBar.isHidden;
if (iOS7Later) {
if (_toolBar.isHidden) {
[UIApplication sharedApplication].statusBarHidden = YES;
} else if (TZ_showStatusBarInitial) {
[UIApplication sharedApplication].statusBarHidden = NO;
}
}
}
......
......@@ -25,7 +25,7 @@
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f)
#define TZ_isGlobalHideStatusBar [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIStatusBarHidden"] boolValue]
#define TZ_showStatusBarInitial (![[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIStatusBarHidden"] boolValue])
@protocol TZImagePickerControllerDelegate;
@interface TZImagePickerController : UINavigationController
......
......@@ -64,7 +64,7 @@
self.navigationBar.barTintColor = [UIColor colorWithRed:(34/255.0) green:(34/255.0) blue:(34/255.0) alpha:1.0];
self.navigationBar.tintColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO;
if (!TZ_isGlobalHideStatusBar) [UIApplication sharedApplication].statusBarHidden = NO;
if (TZ_showStatusBarInitial) [UIApplication sharedApplication].statusBarHidden = NO;
}
}
......@@ -125,7 +125,7 @@
if (self.isStatusBarDefault) {
[UIApplication sharedApplication].statusBarStyle = iOS7Later ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque;
}else{
} else {
[UIApplication sharedApplication].statusBarStyle = iOS7Later ? UIStatusBarStyleLightContent : UIStatusBarStyleBlackOpaque;
}
}
......@@ -536,7 +536,7 @@
- (void)willInterfaceOrientionChange {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (![UIApplication sharedApplication].statusBarHidden) {
if (iOS7Later && !TZ_isGlobalHideStatusBar) [UIApplication sharedApplication].statusBarHidden = NO;
if (iOS7Later && TZ_showStatusBarInitial) [UIApplication sharedApplication].statusBarHidden = NO;
}
});
}
......
......@@ -387,9 +387,7 @@
if (currentTime.value == durationTime.value) [_player.currentItem seekToTime:CMTimeMake(0, 1)];
[_player play];
[_playButton setImage:nil forState:UIControlStateNormal];
if (!TZ_isGlobalHideStatusBar && iOS7Later) {
[UIApplication sharedApplication].statusBarHidden = YES;
}
if (iOS7Later) [UIApplication sharedApplication].statusBarHidden = YES;
if (self.singleTapGestureBlock) {
self.singleTapGestureBlock();
}
......
......@@ -68,9 +68,7 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
if (!TZ_isGlobalHideStatusBar) {
if (iOS7Later) [UIApplication sharedApplication].statusBarHidden = YES;
}
if (_currentIndex) [_collectionView setContentOffset:CGPointMake((self.view.tz_width + 20) * _currentIndex, 0) animated:NO];
[self refreshNaviBarAndBottomBarState];
}
......@@ -78,8 +76,8 @@
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
if (!TZ_isGlobalHideStatusBar) {
if (iOS7Later) [UIApplication sharedApplication].statusBarHidden = NO;
if (TZ_showStatusBarInitial && iOS7Later) {
[UIApplication sharedApplication].statusBarHidden = NO;
}
[TZImageManager manager].shouldFixOrientation = NO;
}
......
......@@ -136,9 +136,7 @@
[self.navigationController setNavigationBarHidden:YES];
_toolBar.hidden = YES;
[_playButton setImage:nil forState:UIControlStateNormal];
if (!TZ_isGlobalHideStatusBar) {
if (iOS7Later) [UIApplication sharedApplication].statusBarHidden = YES;
}
} else {
[self pausePlayerAndShowNaviBar];
}
......@@ -179,8 +177,8 @@
[self.navigationController setNavigationBarHidden:NO];
[_playButton setImage:[UIImage imageNamedFromMyBundle:@"MMVideoPreviewPlay"] forState:UIControlStateNormal];
if (!TZ_isGlobalHideStatusBar) {
if (iOS7Later) [UIApplication sharedApplication].statusBarHidden = NO;
if (TZ_showStatusBarInitial && iOS7Later) {
[UIApplication sharedApplication].statusBarHidden = NO;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment