我想创建iPad相机,然后再创建纵向的iPhone相机应用。
当我从相册(设备相册)中选择照片时,iPad应用会引发错误:Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'
这是我从相册中选择照片的代码:
UIImagePickerController *pickerController = [[UIImagePickerController alloc] init];
pickerController.delegate = self;
pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
pickerController.mediaTypes = @[(NSString *) kUTTypeImage];
pickerController.allowsEditing = NO;
[self presentViewController:pickerController animated:YES completion:nil];
我必须添加什么才能使其从具有横向方向的iPad上访问?
最佳答案
我找到解决方法,结案了。
我在我的appdelegate.m中添加:
-(NSUInteger)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
else /* iphone */
return UIInterfaceOrientationMaskAllButUpsideDown;
}
关于ios - ipad相机界面方向,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27496236/