ipad相机界面方向

时间:2014-12-16 01:44:19

标签: ios objective-c ipad

我想创建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进行访问?

2 个答案:

答案 0 :(得分:1)

我找到了解决方案,案件已经结案。 我添加了 appdelegate.m

-(NSUInteger)application:(UIApplication *)application 
    supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationMaskAll;
    else  /* iphone */
        return UIInterfaceOrientationMaskAllButUpsideDown;
}

答案 1 :(得分:0)

它工作正常,但是当我们启动应用程序时,它在左侧显示肖像..所以请告诉我们如何限制所有肖像事件。 - (NSUInteger)应用程序:(UIApplication *)应用程序 supportedInterfaceOrientationsForWindow:(UIWindow )窗口 {if(UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPhone) 返回UIInterfaceOrientationMaskAll; else / iphone * / returnUIInterfaceOrientationMaskAllButUpsideDown; }