大佬教程收集整理的这篇文章主要介绍了UIIMagePickerController在iPad ios 6.0上解散时崩溃,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个带有以下init的ViewController(MyPickerController):
- (id)init { self = [super init]; if (self) { _picker = [[UIImagePickerController alloc] init]; _picker.delegate = self; _picker.sourCEType = UIImagePickerControllersourceTypeCamera; [self.view addSubview:_picker.view]; } return self; }
我实现了以下UIPickerControllerDelegate方法来dimiss MyPickerController:
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { [self dismissviewControllerAnimated:YES completion:nil]; }
好吧,我有另一个视图控制器在FormSheetStyle中显示模态,当我点击一个按钮时,我想用以下代码@L_333_6@myPickerController:
@H_869_9@myPickerController * pickerVC = [[MyPickerController alloc] init]; [self presentViewController:pickerVC animated:YES completion:nil];
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return (NSUInteger)[application supportedInterfaceOrientationsForWindow:window] | (1<<UIInterfaceOrientationPorTrait); }
当我点击UIIMagePicker的取消按钮进入MyPickerController时,应用程序崩溃并出现以下错误:
TerminaTing app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation',reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!
阅读stackoverflow上的相关问题,我还创建了以下UIImagePickerController类:
@implementation UIImagePickerController (NonRotaTing) - (BOOL)shouldAutorotate { return NO; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationMaskPorTrait; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPorTrait; } @end
谢谢!
如果您的视图控制器位于UINavigationController中,则应将此类别用于navigationcontroller:
@implementation UINavigationController (autorotatE) - (NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskAll; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ return UIInterfaceOrientationMaskPorTrait; } @end
以上是大佬教程为你收集整理的UIIMagePickerController在iPad ios 6.0上解散时崩溃全部内容,希望文章能够帮你解决UIIMagePickerController在iPad ios 6.0上解散时崩溃所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。