我有一个标签栏,可以像这样调用UIImagePickerController
:
UIImagePickerController *photo = [[UIImagePickerController alloc] init];
photo.delegate = self;
photo.allowsEditing = NO;
photo.sourceType = UIImagePickerControllerSourceTypeCamera;
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[self presentViewController:photo animated:YES completion:nil];
但状态栏仍然保持setStatusBarHidden
到YES
。
答案 0 :(得分:0)
尝试实现以下委托方法:
- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
答案 1 :(得分:0)
请仔细阅读以下代码
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if([navigationController isKindOfClass:[UIImagePickerController class]]&& ((UIImagePickerController*)navigationController).sourceType == UIImagePickerControllerSourceTypeCamera)
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
}
答案 2 :(得分:0)
转到Xcode中的plist文件,将此键转到no
查看基于控制器的状态栏外观'并设置为NO。,这对我来说就是这个伎俩