0

iPad用のアプリ(ドラムマシン)を開発しています。ユーザーインターフェイスのドラフトがあります。iOS 6.1シミュレーターでは、インターフェースはOKです。

iOS6.1のインターフェース

しかし、iOS5.1シミュレーターでは90°になっています。

iOS5.1のインターフェース

これは私がビューを呼び出す方法です(stackoverflowメンバーからの助けの後)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{    
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[XDrumViewController alloc] initWithNibName:@"XDrumViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
 }

それを解決する方法は?

4

1 に答える 1

2

定義していない可能性があります

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;

これは、iOS <6で自動回転を機能させるために必要です(ここを参照)。簡単なテストのために、以下を定義します。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

ビューコントローラで。これにより、横向きのみの自動回転が有効になります(つまり、コントローラーを横向きに強制します)。

于 2013-03-02T11:19:56.633 に答える