我使用UIImagepickercontroller拍照和选择现有照片,在相机视图出现时,相机顶部被白色状态栏遮盖。我该如何去除或隐藏状态栏?许多人都说这是iOS 7的一个bug,已经在iOS 7.1中修复了,但我仍然面临着这个问题。
这是我展示imagepickerController的代码:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = (id)self;
imagePicker.sourceType = (buttonIndex == actionSheet.firstOtherButtonIndex ?
UIImagePickerControllerSourceTypeCamera : UIImagePickerControllerSourceTypePhotoLibrary);
[self.viewController presentViewController:imagePicker animated:YES completion:nil];
我尝试使用以下代码隐藏状态栏:
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
This
-(BOOL) prefersStatusBarHidden {
return YES;
}
委托中的This关键字
[UIApplication ShareApplication]SetStatusbarHidden:YES];
我现在正在使用ios8,而这种行为在所有ios版本中都会发生。 请帮助我解决这个问题。