1

こんばんは!縦向きのアプリケーションを開発していますが、アプリの残りの部分を台無しにすることなく、1 つのビューのみの向きをランドスペースに変更する方法があるかどうか迷っていました。

戻してみた

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
  //return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

しかし運が悪い... IBではView Controllerの向きが横向きに設定されていますが、アプリを実行すると縦向きモードで表示され続けます...

[[UIApplication sharedApplication]setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];

運悪く…

どんな助けでも大歓迎です。

ありがとうございました。

4

3 に答える 3

3

ビューの変換を手動で設定して回転させることができます。たとえば、90度回転するには:

view.transform = CGAffineTransformMakeRotation( M_PI / 2 );
于 2012-04-25T13:48:21.640 に答える
2

私のために働いた唯一のものは使用していました

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

私のViewControllerで、presentModalViewControllerを使用して表示します。これにより、ビューは横向きのままになります。

于 2012-04-25T14:08:29.317 に答える
1
 [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];

イベントに書き込みます。

于 2013-04-02T08:42:22.347 に答える