0

NLViewController サブクラスの縦向きビューと別の横向きビューを作成しました。デバイスを回転させて他の VC サブクラスから横向きにすると、他のすべてのビュー コントローラー サブクラスに対してこの別の横向きビューが表示されます。NLVIewController が呼び出されたときに、この代替横長ビューのみを表示するステートメントを含めるにはどうすればよいですか?

-(void)orientationDidChanged: (NSNotification *)notification {
    UIDeviceOrientation devOrientation = [UIDevice currentDevice].orientation;
    if (UIDeviceOrientationIsLandscape(devOrientation)) {
        UIStoryboard *main = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
        LandscapeController *landscape = [main instantiateViewControllerWithIdentifier:@"landscape"];
        [self presentViewController:landscape animated:YES completion:nil];
    } else if (UIDeviceOrientationIsPortrait(devOrientation)) {
        [self dismissViewControllerAnimated:YES completion:nil];
    }
}
4

0 に答える 0