首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ipad摄像头界面方向

ipad摄像头界面方向
EN

Stack Overflow用户
提问于 2014-12-16 09:44:19
回答 2查看 547关注 0票数 0

我想创建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'

下面是我从相册中选择照片的代码:

代码语言:javascript
复制
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访问它?

EN

回答 2

Stack Overflow用户

发布于 2014-12-16 11:38:57

我找到了解决方案,结案了。我在我的应用程序中添加了。m

代码语言:javascript
复制
-(NSUInteger)application:(UIApplication *)application 
    supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationMaskAll;
    else  /* iphone */
        return UIInterfaceOrientationMaskAllButUpsideDown;
}
票数 1
EN

Stack Overflow用户

发布于 2016-10-12 20:11:00

-(NSUInteger)应用程序:(UIApplication*)应用程序窗口)窗口{if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) return UIInterfaceOrientationMaskAll;else / iphone */returnUIInterfaceOrientationMaskAllButUpsideDown;}

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27496236

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档