我需要一个UIImagePickerCOntroller,以便用户可以拍摄一些照片。这是我的代码:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.showsCameraControls = YES;
imagePicker.allowsEditing = YES;
imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:imagePicker animated:YES completion:nil];
}
我第一次打开UIImagePickerController一切正常!但对于第二,第三......时间我总是得到这个:
正如您所看到的,上面的相机控制被切断了。看起来StatusBar就是问题所在。我尝试了一切:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
或
[[UIApplication sharedApplication] setStatusBarHidden:YES];
但没有任何效果。也许是Apple Bug?
答案 0 :(得分:0)
试试这个:
答案 1 :(得分:0)
在视图控制器中实施- (BOOL)prefersStatusBarHidden
,并根据当前条件返回YES
或NO
。如果要隐藏/显示,请在视图控制器上调用- (void)setNeedsStatusBarAppearanceUpdate
。