Well, I didn’t understand your problem better, but as soon as I have many lines that work perfectly with rotation in iOS 8.1, I will present them to you. They are simply taken and slightly edited from the Apple API reference.
I just put this in every VC, and I just edit the code when necessary. For example, I have an application that has an initial view controller on a portrait, and then changes the VC (segue completed) from LandscapeVC with various functions. These are portrait view methods that cause rotation in the LandscapeView.
bool isShowingLandscapeView = false; - (void)awakeFromNib { isShowingLandscapeView = NO; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; } - (void)orientationChanged:(NSNotification *)notification { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView) { isShowingLandscapeView = YES; [self performSegueWithIdentifier:@"toLandscape" sender:self]; }
Hope I made it easy to understand. Feel free to improve your answer, we all learn in this life!
source share