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