私のアプリでは、非推奨になった shouldAutoRotateToFace メソッドを使用しています。iOS 6 シミュレーターを使用すると、デバイスが横向きのときにすべてのサブビューが縦向きに回転します。誰がこれを引き起こす可能性があるか考えていますか? メイン ビュー コントローラーの should autorotate を supportedOrientations メソッド (または代わりに使用することになっているもの) に置き換えることは既に試みました。
質問する
2951 次
1 に答える
7
Apple dev フォーラムにログインできる場合は、このスレッドを確認してください。
基本的に、これは私を助けた情報です:
1.私は始めなければなりませんでしwindow.rootViewController = mainViewController
た
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
2.ビューコントローラーの場合
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
戻ってきただけでなくYES
、追加する必要がありました
- (NSUInteger)supportedInterfaceOrientations
同じ値を返した
3.追加
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
mainViewController.m へ
4.追加
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
appDelegate.m へ (アプリの Info.plist ファイルまたは個々のビュー コントローラーで指定されていない場合にデフォルト値を設定するため、これはオプションであると思います)
XCode 4.3 を使用してコンパイルする必要があるため
、コードを 3.0 に後方互換性を持たせたいので、すべての方向マスクを使用しませんでした。
于 2012-09-23T03:32:56.093 に答える