I am trying to lunch Aviary SDK photo editor in landscape mode , but it works only on iPad !! , my app crashes on iPhone due this problem :

'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

I tried different ways but no success :

- (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];
}

none of these codes worked :

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 ;

  }

my app is running on iOS 6 , appreciate for any help

有帮助吗?

解决方案

From Aviary FAQ:

Q: How do I change the supported orientations for the editor?

A: On the iPhone form factor, the Editor is restricted to Portrait presentation only. [...]

That means what you want is impossible. The editor must run in Portrait mode.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top