Commit 55c8a1fd authored by yuzheng.tz's avatar yuzheng.tz

优化对状态栏的处理

parent 788f3677
...@@ -108,10 +108,11 @@ ...@@ -108,10 +108,11 @@
- (void)signleTapAction { - (void)signleTapAction {
_toolBar.hidden = !_toolBar.isHidden; _toolBar.hidden = !_toolBar.isHidden;
[self.navigationController setNavigationBarHidden:_toolBar.isHidden]; [self.navigationController setNavigationBarHidden:_toolBar.isHidden];
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (iOS7Later) { if (iOS7Later) {
if (_toolBar.isHidden) { if (_toolBar.isHidden) {
[UIApplication sharedApplication].statusBarHidden = YES; [UIApplication sharedApplication].statusBarHidden = YES;
} else if (TZ_showStatusBarInitial) { } else if (tzImagePickerVc.needShowStatusBar) {
[UIApplication sharedApplication].statusBarHidden = NO; [UIApplication sharedApplication].statusBarHidden = NO;
} }
} }
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f) #define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f) #define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f)
#define TZ_showStatusBarInitial (![[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIStatusBarHidden"] boolValue])
@protocol TZImagePickerControllerDelegate; @protocol TZImagePickerControllerDelegate;
@interface TZImagePickerController : UINavigationController @interface TZImagePickerController : UINavigationController
...@@ -126,6 +124,7 @@ ...@@ -126,6 +124,7 @@
- (void)showProgressHUD; - (void)showProgressHUD;
- (void)hideProgressHUD; - (void)hideProgressHUD;
@property (nonatomic, assign) BOOL isSelectOriginalPhoto; @property (nonatomic, assign) BOOL isSelectOriginalPhoto;
@property (assign, nonatomic) BOOL needShowStatusBar;
@property (nonatomic, copy) NSString *takePictureImageName; @property (nonatomic, copy) NSString *takePictureImageName;
@property (nonatomic, copy) NSString *photoSelImageName; @property (nonatomic, copy) NSString *photoSelImageName;
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.needShowStatusBar = ![UIApplication sharedApplication].statusBarHidden;
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.navigationBar.barStyle = UIBarStyleBlack; self.navigationBar.barStyle = UIBarStyleBlack;
self.navigationBar.translucent = YES; self.navigationBar.translucent = YES;
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
self.navigationBar.barTintColor = [UIColor colorWithRed:(34/255.0) green:(34/255.0) blue:(34/255.0) alpha:1.0]; 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.navigationBar.tintColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO; self.automaticallyAdjustsScrollViewInsets = NO;
if (TZ_showStatusBarInitial) [UIApplication sharedApplication].statusBarHidden = NO; if (self.needShowStatusBar) [UIApplication sharedApplication].statusBarHidden = NO;
} }
} }
...@@ -536,7 +537,7 @@ ...@@ -536,7 +537,7 @@
- (void)willInterfaceOrientionChange { - (void)willInterfaceOrientionChange {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (![UIApplication sharedApplication].statusBarHidden) { if (![UIApplication sharedApplication].statusBarHidden) {
if (iOS7Later && TZ_showStatusBarInitial) [UIApplication sharedApplication].statusBarHidden = NO; if (iOS7Later && self.needShowStatusBar) [UIApplication sharedApplication].statusBarHidden = NO;
} }
}); });
} }
......
...@@ -76,7 +76,8 @@ ...@@ -76,7 +76,8 @@
- (void)viewWillDisappear:(BOOL)animated { - (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated]; [super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES]; [self.navigationController setNavigationBarHidden:NO animated:YES];
if (TZ_showStatusBarInitial && iOS7Later) { TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (tzImagePickerVc.needShowStatusBar && iOS7Later) {
[UIApplication sharedApplication].statusBarHidden = NO; [UIApplication sharedApplication].statusBarHidden = NO;
} }
[TZImageManager manager].shouldFixOrientation = NO; [TZImageManager manager].shouldFixOrientation = NO;
......
...@@ -180,7 +180,8 @@ ...@@ -180,7 +180,8 @@
[self.navigationController setNavigationBarHidden:NO]; [self.navigationController setNavigationBarHidden:NO];
[_playButton setImage:[UIImage imageNamedFromMyBundle:@"MMVideoPreviewPlay"] forState:UIControlStateNormal]; [_playButton setImage:[UIImage imageNamedFromMyBundle:@"MMVideoPreviewPlay"] forState:UIControlStateNormal];
if (TZ_showStatusBarInitial && iOS7Later) { TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (tzImagePickerVc.needShowStatusBar && iOS7Later) {
[UIApplication sharedApplication].statusBarHidden = NO; [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