3

1 つの NavigationController と 4 つの UIViewController を持つアプリがあります。私は、UIInterfaceOrientationPortrait に 3 つの UIViewController と、Landscape モードに 1 つの UIViewController を配置したいと考えています。ビューが表示されると、横方向がすぐに表示されます。残念ながら、デバイスを回転させたときにのみモードが変わります。デバイスを回転させずにすぐに横向きにするにはどうすればよいですか?

これが私のNavigationController.mのコードです

-(NSUInteger)supportedInterfaceOrientations
{
    return [self.topViewController supportedInterfaceOrientations];
}



- (BOOL)shouldAutorotate
{
    return [self.topViewController shouldAutorotate];
}

これは Portrait UIViewcontroller.m 用です。

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

ランドスケープ UIViewController.m の場合:

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight;
}


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    //  (iOS 6)
    //  Force to portrait
    return UIInterfaceOrientationLandscapeRight;
}

よろしくお願いします。

4

0 に答える 0