17

私の現在のプログラムは、横向きのみをサポートしています。

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

'UIApplicationInvalidInterfaceOrientation'、理由: 'サポートされている向きにはアプリケーションと共通の向きがなく、shouldAutorotate は YES を返しています'

project のすべての向きを有効にしましたが、うまく機能しています。ただし、すべてのビューでランドスケープのみをサポートするには、多くの変更が必要です。

を修正する他の簡単な方法はありUIOrientationますUIPopoverControllerか?

4

5 に答える 5

0
@interface NonRotatingUIImagePickerController : UIImagePickerController

@end

@implementation NonRotatingUIImagePickerController

- (BOOL)shouldAutorotate
{
    return NO;
}

@end

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

上記のコードを使用すると、これでうまくいきました。

于 2013-03-25T11:22:41.310 に答える
0
Use these delegates for orientation,
- (BOOL)shouldAutorotate
{

return YES;
}

-(NSUInteger)supportedInterfaceOrientations

{
return UIInterfaceOrientationMaskLandscape;

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
  return UIInterfaceOrientationLandscapeLeft;
}
于 2013-04-19T13:58:28.330 に答える
0

UIImagePickerController の新しいサブクラスを作成し、次のコードを追加します。

@property (nonatomic)NSUInteger supportedInterfaceOrientations;

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

次のように使用します。

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

良い方法を知っている人は教えてください。

于 2012-09-24T03:49:24.880 に答える
0

あなたのこのリンク。最初にすべての向きをサポートするようにアプリケーションを設定する必要があります。アプリデリゲートで変更を行います。

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

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

}
于 2012-10-16T09:34:04.910 に答える
0

以下を に追加してみてくださいUIApplicationDelegate:

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

サポートされているインターフェイスの向きをファイルに設定したり、各ビュー コントローラーのメソッドInfo.plistでマスクを返すことで設定したりできます。supportedInterfaceOrientations:

于 2012-09-21T05:37:52.333 に答える