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 で実行されています。