我正在尝试在横向模式下使用 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 上运行,感谢您的帮助