Created
July 22, 2014 10:09
-
-
Save Xummer/8a55bc8d06e26766e94c to your computer and use it in GitHub Desktop.
iOS 7 相机隐藏状态栏,dismiss时消除下坠20像素动画
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface CustomImagePickerController : UIImagePickerController | |
{ | |
BOOL m_bWillDisappear; | |
} | |
@end | |
@implementation CustomImagePickerController | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
m_bWillDisappear = NO; | |
} | |
- (void)viewWillDisappear:(BOOL)animated { | |
m_bWillDisappear = YES; | |
[super viewWillDisappear:animated]; | |
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { | |
[self setNeedsStatusBarAppearanceUpdate]; | |
} | |
} | |
#pragma mark - StatusBar | |
- (UIStatusBarStyle)preferredStatusBarStyle | |
{ | |
return UIStatusBarStyleLightContent; // change this to match your style | |
} | |
- (BOOL)prefersStatusBarHidden { | |
switch (self.sourceType) { | |
case UIImagePickerControllerSourceTypeCamera: | |
if (m_bWillDisappear) { | |
return [self.navigationController.presentingViewController prefersStatusBarHidden]; | |
} | |
else { | |
return YES; | |
} | |
break; | |
default: | |
return NO; | |
break; | |
} | |
} | |
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation { | |
return UIStatusBarAnimationNone; | |
} | |
- (UIViewController *)childViewControllerForStatusBarHidden { | |
switch (self.sourceType) { | |
case UIImagePickerControllerSourceTypeCamera: | |
return nil; | |
break; | |
default: | |
return [super childViewControllerForStatusBarHidden]; | |
break; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment