标签:ios uiimagepickercontrol ipad
在iPad下打开相册或者拍照,如果使用 UIImagePickerController 打开相册或者拍照,那必须要用到 UIPopoverController 去打开。
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker]; self.popoverController = popover; [self.popoverController presentPopoverFromRect:CGRectMake(0, 0, 600, 800) inView:self.viewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
但是在iOS8的iPad环境下,却打不开相册或者拍照,提示如下:
Warning: Attempt to present <UIImagePickerController: 0x7fb3d1167a00> on <CubeWebViewController: 0x7fb3d324ad20> which is already presenting (null)
解决方法如下:
[[NSOperationQueue mainQueue] addOperationWithBlock:^{ UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker]; self.popoverController = popover; [self.popoverController presentPopoverFromRect:CGRectMake(0, 0, 600, 800) inView:self.viewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; }];
参考:http://stackoverflow.com/questions/24942282/uiimagepickercontroller-not-presenting-in-ios-8
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:ios uiimagepickercontrol ipad
原文地址:http://blog.csdn.net/chgsh_2008/article/details/47728295