6

iOS6以降、回転に大きな問題があります。すべての新しい回転メソッド(shouldAutorotate、preferredInterfaceOrientationForPresentation、supportedInterfaceOrientation)を実装しましたが、すべてのビューはまだ回転しています。面白いのは、ビューがそのサイズを維持していて、ウィンドウの残りの部分(横向き)が黒であるということです。

それは私がそれを実装する方法です、何か問題がありますか?

#pragma mark -
#pragma mark - InterfaceOrientation iOS 5 
//Deprecated in iOS 6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark -
#pragma mark - InterfaceOrientation iOS 6

- (BOOL)shouldAutorotate{
    return NO;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationPortrait;
}

- (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortraitUpsideDown;
}

あなたの助けの人々に感謝します。

4

4 に答える 4

0

私も持っていたので、NOに回しても回転します。

2つのオプション:

  1. プロジェクト設定に移動し、可能な方向を変更します

  2. AUTOROTATEのすべてのメソッドを削除します。NOに設定されていても、回転してくれます。

于 2012-10-08T09:05:42.880 に答える
-1
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
    //Make sure your window to assgin the view controller object to rootViewController, Please don't add controller view as a sub view on window.
    self.window.rootViewController = viewController;
}
于 2012-10-08T08:19:53.147 に答える