In iOS 8, the methods for interface rotation are deprecated. This includes:
willRotateToInterfaceOrientation:duration:
didRotateFromInterfaceOrientation:
willAnimateRotationToInterfaceOrientation:duration:
The replacement methods include:
willTransitionToTraitCollection:withTransitionCoordinator:
viewWillTransitionToSize:withTransitionCoordinator:
If the new rotation methods are not implemented, and a project is compiled with the iOS 8 SDK, the view controllers -will not receive calls- to the deprecated rotation methods.
My concern is this: What happens to an app already in the AppStore built with the iOS 7 SDK? Will the deprecated rotation methods still be called on an iOS 8 device or not?
EDIT:
The rotation methods are still called, but there exist some changes/issues/bugs in iOS 8.
Also UIScreen
is now interface oriented
I just had this issue and I wanted to use the same methods that I was using before (at least for now), so this is what I did.
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; //The device has already rotated, that's why this method is being called. UIInterfaceOrientation toOrientation = [[UIDevice currentDevice] orientation]; //fixes orientation mismatch (between UIDeviceOrientation and UIInterfaceOrientation) if (toOrientation == UIInterfaceOrientationLandscapeRight) toOrientation = UIInterfaceOrientationLandscapeLeft; else if (toOrientation == UIInterfaceOrientationLandscapeLeft) toOrientation = UIInterfaceOrientationLandscapeRight; UIInterfaceOrientation fromOrientation = [[UIApplication sharedApplication] statusBarOrientation]; [self willRotateToInterfaceOrientation:toOrientation duration:0.0]; [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { [self willAnimateRotationToInterfaceOrientation:toOrientation duration:[context transitionDuration]]; } completion:^(id<UIViewControllerTransitionCoordinatorContext> context) { [self didRotateFromInterfaceOrientation:fromOrientation]; }]; }
I'm still not sure if I should use this outside of the animation block since I don't have the duration.
[self willRotateToInterfaceOrientation:toOrientation duration:0.0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With