我得到了这段代码,如果设备处于横向左/右或倒置状态,它会旋转并显示另一个视图控制器。但是如果它的方向是朝上还是朝下,那么我怎么知道它是横向模式还是纵向模式?因为我只想在它朝上或朝下并处于横向模式时旋转
    - (void)viewDidAppear:(BOOL)animated
    {
        UIDeviceOrientation orientation = [[UIDevice currentDevice]orientation];
        NSLog(@"orientation %d", orientation);
        if ((orientation == 2) || (orientation == 3) || (orientation == 4))
        {
            [self performSegueWithIdentifier:@"DisplayLandscapeView" sender:self];
            isShowingLandscapeView = YES;
    }
}