【发布时间】:2014-04-01 09:30:38
【问题描述】:
我需要一个 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 一切正常!但是对于第二次,第三次......我总是得到这个:
如您所见,上面的摄像头控件被剪掉了。看起来状态栏是问题所在。我尝试了以下所有方法:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
或
[[UIApplication sharedApplication] setStatusBarHidden:YES];
但没有任何效果。可能是 Apple Bug?
【问题讨论】:
标签: ios objective-c uiimagepickercontroller statusbar uistatusbar