4

私はiosが初めてです。

モードで1つだけを表示し、他のすべてをポートレートviewControllerで表示したい。landscape

だから私を助けてlandscape、アプリのモードで1つのビューだけを変更する方法を教えてください。

すでに検索しましたが、特定の答えは見つかりませんでした。

4

3 に答える 3

4

ナビゲーションコントローラーを使用していて、この「横向き」ビューコントローラーをプッシュしているコントローラーがポートレートモードのみの場合は、CGAffineTransformationを使用してuiviewを手動で回転させる必要があります。

- (void)viewDidLoad
{
    [super viewDidLoad];
    // If you require full screen then hide the navigation bar with following commented line.
    //[self.navigationController setNavigationBarHidden:YES animated:NO];

    // Rotates the view.

    CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI/2);
    self.view.transform = transform;

    // Repositions and resizes the view.
    // If you need NavigationBar on top then set height appropriately 
    CGRect contentRect = CGRectMake(0, 0, 480, 320);
    self.view.bounds = contentRect;
}
于 2012-12-05T14:11:46.293 に答える
2

iOS6 の場合、このメソッドをViewController

-(NSUInteger)supportedInterfaceOrientations
{

    return UIInterfaceOrientationMaskLandscape;
}
于 2012-12-05T12:59:33.590 に答える
0

UINavigationController を使用していますか?

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

-(BOOL) shouldAutorotate {
    return YES;
}
于 2012-12-05T13:10:43.947 に答える