呈现时,UIImagePickerController不适合窗口

时间:2014-02-27 13:21:27

标签: ios iphone objective-c uiimagepickercontroller

我正在尝试开发一个简单的应用程序,它将与用户拍摄的照片一起使用。通过跟随https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/TakingPicturesAndMovies.html我正在使用UIImagePickerController来拍摄快照。我有一个带有单个空视图控制器的基本应用程序,在viewDidAppear方法中,我执行以下操作:

- (void)viewDidAppear:(BOOL)animated
{
if ([UIImagePickerController isSourceTypeAvailable:
     UIImagePickerControllerSourceTypeCamera] == NO)
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Error" message: @"Can't use the camera!" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [alert show];

    return;
}

UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;

cameraUI.allowsEditing = NO;

cameraUI.delegate = self;

[self presentViewController: cameraUI animated: YES completion:NULL];

}

结果视图变为: Image Picker

正如您所看到的,前后摄像头更改按钮未完全显示且UIImagePickerController不适合屏幕。我应该在呈现之前另外调整大小还是我做错了什么?

0 个答案:

没有答案