1

iOS 6ShouldAutorotateToInterfaceOrientationで廃止されたため、アプリで向きをロックできません。複数のビューを持つ私のアプリでは、一部のビューは縦向きと横向きの両方をサポートする必要があり、他のビューは縦向きのみをサポートする必要があります。どうすればこの問題を克服できますか?アイデアを教えてください。UINavigationControllers

ありがとう

4

4 に答える 4

2

この機能はiOS 6でのみ使用できます

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

{

    return UIInterfaceOrientationMaskPortrait;

}
于 2012-09-26T12:02:58.377 に答える
0

私は、ShouldAutorotateToInterfaceOrientation の代替を見つけました。これらのリンクを参照することをお勧めします -

http://www.roostersoftstudios.com/2012/09/21/ios6-autorotation-changes

ありがとう

于 2012-10-08T06:17:48.130 に答える
0

次のコードを viewDidLoad に追加します

UIViewController *viewController = [[UIViewController alloc] init];
[self presentModalViewController:viewController animated:NO];
[self dismissModalViewControllerAnimated:NO];

縦向きのロック用

  • 属性インスペクタ タブを選択します。
  • 向きを縦に設定します。

関数を追加する

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ( UIInterfaceOrientationIsPortrait(interfaceOrientation)); 
}

横向きのロック用

  • 属性インスペクタ タブを選択します。
  • 方向を横向きに設定します。

関数を追加する

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ( UIInterfaceOrientationIsLandscape(interfaceOrientation) ); 
}
于 2012-09-26T12:00:43.077 に答える