2012-08-13 7 views
17

現在のプログラムでは、横向きのみがサポートされています。iOS 6のUIPopoverControllerオリエンテーションクラッシュ

iOS 6では、UIPopoverControllerがクラッシュします。

「UIApplicationInvalidInterfaceOrientation」、理由:「サポートされている の向きは、アプリケーションと共通の方向性を持っていない、と shouldAutorotateがYES戻っている」が

私はプロジェクトのすべてのオリエンテーションを有効にする、それがうまく機能しています。しかし、すべてのビューがランドスケープのみをサポートするためには、多くを変更する必要があります。

UIOrientationUIPopoverControllerに修正する他の簡単な方法はありますか?

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { 
    return UIInterfaceOrientationMaskAll; 
} 

あなたはまだあなたのInfo.plistファイルで、各ビューコントローラのsupportedInterfaceOrientations:方法でマスクを返すことによってサポートされているインターフェイスの向きを設定することができます。あなたのUIApplicationDelegateに以下を追加し

+2

こんにちは@satungod、私の回答は残念ながらモデレータによって削除されました。私はすでに別のスレッドに投稿していました。この回答をここで見つけてください:http://stackoverflow.com/a/12575058/662605 - 私は別のものに向ける新しい答えを追加しています。 – Daniel

答えて

0

してみてください。

+0

これは正しいですhttps://devforums.apple.com/message/731764#731764 – Zeophlite

0

新UIImagePickerControllerのサブクラスと、このコードを追加します。

if (imagePickerController==nil) { 
     imagePickerController = [[WUIImagePickerController alloc]init];//the subclass 
     imagePickerController.delegate = self; 
     imagePickerController.supportedInterfaceOrientations = UIInterfaceOrientationMaskLandscapeRight;//any orientation you want to set 
     if (popoverController==nil) { 
      popoverController = [[UIPopoverController alloc]initWithContentViewController:imagePickerController]; 
     } 
    } 

を教えてくださいより良い方法を知っている人:

@property (nonatomic)NSUInteger supportedInterfaceOrientations; 

-(NSUInteger)supportedInterfaceOrientations{ 
    return _supportedInterfaceOrientations; 
} 
-(BOOL)shouldAutorotate{ 
    return YES; 
} 

はこのようにそれを使用してください。

+1

ダニエルの答えを見てください。答えのあるリンクがあります。 –

+1

これはセッターメソッドではありません imagePickerController.supportedInterfaceOrientations = UIInterfaceOrientationMaskLandscapeRight; 全く間違っています... –

0

Thy this link。最初にすべての向きをサポートするようにアプリケーションを設定する必要があります。アプリケーション代理人の変更を行います。

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window 

{ 
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
     return UIInterfaceOrientationMaskAll; 
    else /* iphone */ 
     return UIInterfaceOrientationMaskAllButUpsideDown; 

} 
0
@interface NonRotatingUIImagePickerController : UIImagePickerController 

@end 

@implementation NonRotatingUIImagePickerController 

- (BOOL)shouldAutorotate 
{ 
    return NO; 
} 

@end 

UIImagePickerController *picker = [[NonRotatingUIImagePickerController alloc] init]; 

使用上記のコードは、これは私のために働きました。

0
Use these delegates for orientation, 
- (BOOL)shouldAutorotate 
{ 

return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations 

{ 
return UIInterfaceOrientationMaskLandscape; 

} 

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    return UIInterfaceOrientationLandscapeLeft; 
} 
関連する問題