在模块呈现的视图控制器上呈现UIImagePickerController在iOS 8中无法正常工作

时间:2014-09-29 06:11:54

标签: ios8 uiimagepickercontroller uimodalpresentationstyle

我从模态呈现的视图控制器中呈现了UIImagePickerController。单击图像后,我得到一个黑色图像而不是点击的图片 我做了这样的事情。

//From ViewController1 I presented view controller2 with 
- (IBAction)buttontappedToPresentViewController2:(id)sender
{
    ViewController2* controller2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
    controller2.modalPresentationStyle = UIModalPresentationPageSheet;
    [self controller2 animated:YES completion:nil];
}


//In ViewController2, I presented the UIIMagePickerController
- (IBAction)cameraButtonTapped:(id)sender
{
    UIImagePickerController *cameraController = [[UIImagePickerController alloc] init];
    cameraController.mediaTypes = @[(NSString *)kUTTypeImage,(NSString*)kUTTypeMovie];
    cameraController.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:cameraController animated:YES completion:NULL];
}

单击图像后,您将获得黑屏而不是拍摄的图像,并重新拍摄并使用照片选项。如果您选择"使用照片"选项可以在回调中获得正确的图像。

注意:如果没有为viewController2设置UIModalPresentationStyle,则代码可以正常工作。

知道这里出了什么问题。

编辑:我使用过XCODE 5.1,目标部署是iOS 7.我在iOS8设备上运行应用程序。

0 个答案:

没有答案
相关问题