0

我正在尝试在横向模式下使用 Aviary SDK 照片编辑器,但它仅适用于 iPad!,由于这个问题,我的应用程序在 iPhone 上崩溃了:

'UIApplicationInvalidInterfaceOrientation',原因:'支持的方向与应用程序没有共同方向,并且 shouldAutorotate 返回 YES'

我尝试了不同的方法但没有成功:

- (IBAction)photoEditor:(id)sender {

    [self displayEditorForImage:imageBG.image];

}


- (void)displayEditorForImage:(UIImage *)imageToEdit
{
 //set device orientation 

    [AFPhotoEditorCustomization setSupportedIpadOrientations:@[@(UIInterfaceOrientationLandscapeRight),
     @(UIInterfaceOrientationLandscapeLeft) ]];


    AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit];
    [editorController setDelegate:self];

    [self presentViewController:editorController animated:YES completion:nil];
}

这些代码都不起作用:

1-

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return ( (interfaceOrientation == UIInterfaceOrientationLandscapeRight) ||
            (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) );
}

2-

-(BOOL)shouldAutorotate
{
    return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;;
}

3-

-(NSUInteger)supportedInterfaceOrientations
 {
 return UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft; // add any other you want
 }



-(BOOL)shouldAutorotate
{

//tried NO too , 
    return YES ;

  }

我的应用程序在 iOS 6 上运行,感谢您的帮助

4

1 回答 1

2

来自 Aviary 常见问题解答:

问:如何更改编辑器支持的方向?

答:在 iPhone 外形尺寸上,编辑器仅限于纵向呈现。[...]

这意味着你想要的东西是不可能的。编辑器必须以纵向模式运行。

于 2013-07-25T10:53:37.353 回答