IOS 8 rotation methods Obsolescence - backward compatibility

In iOS 8, interface rotation methods are deprecated . It includes:

  • willRotateToInterfaceOrientation:duration:
  • didRotateFromInterfaceOrientation:
  • willAnimateRotationToInterfaceOrientation:duration:

Replacement methods include:

  • willTransitionToTraitCollection:withTransitionCoordinator:
  • viewWillTransitionToSize:withTransitionCoordinator:

If new rotation methods are not implemented, and the project is compiled using the iOS 8 SDK, view controllers - will not accept calls - to outdated rotation methods.

I am worried about the following: What happens to an application already in the AppStore created using the iOS 7 SDK? Will obsolete rotation methods be called on an iOS 8 device or not?

EDIT:

Rotation methods are still being called, but there are some changes / problems / errors in iOS 8.

UIScreen is also now interface oriented

+52
ios rotation ios8
Aug 11 '14 at 8:15
source share
6 answers

Rotation methods become obsolete in the iOS 8 SDK. This will not have any effect on applications built using the iOS 7 SDK, even those running iOS 8 and possibly several future versions of iOS.

As an example, the font UIButton property has UIButton deprecated since iOS 3.0 and is still available in iOS 7.0.

+19
Aug 11 '14 at 8:37
source share

I had this problem and I wanted to use the same methods as 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 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 that I should use this outside the animation block, since I have no duration.

  [self willRotateToInterfaceOrientation:toOrientation duration:0.0]; 
+36
01 Oct '14 at 0:46
source share

The listed obsolete rotation methods are still called when the application launches on iOS 8+ devices. If you support iOS 7, you can continue to use them without a problem. If you only support iOS 8+, it would be wise to use legacy methods instead.

However, note that if you implement new rotation methods and obsolete views in the same controller, obsolete methods will be called when running on iOS 7, and only new methods will be called on iOS 8+ that replace those that are deprecated.

For example, if you only use willRotateToInterfaceOrientation , this method will be called when running on iOS 7 and 8. If you then add viewWillTransitionToSize , iOS 7 will still call willRotateToInterfaceOrientation , but iOS 8 will not, instead, it will only call viewWillTransitionToSize .

+6
Aug 12 '14 at 4:01
source share

I would check that a particular case has 100% confidence, but I do not expect any problems. I also recommend that you watch the 216 Building Adaptive Apps with UIKit from WWDC 2014 for more information. It seems that depreciated methods are not called, so the application must be updated to work properly with devices running iOS 8.

+2
Aug 11 '14 at 8:45
source share

Rotation methods still work, BUT there are other problems:

  • with views added to windows: Rotation issue with ios 8 for views which are added to windows
+1
Sep 29 '14 at 7:12
source share

For me, here we rotate “things manually” with some calculations and a plist file that track the size of headers and the like (therefore, if we want to change something, buttons, etc., we change this layer not all individual xibs) . And all of our rotation code is inside willLayoutSubviews , so all things are true even on the new iOS8 ... except for me. I also saw that for the new ios8 [[UIScreen mainScreen] bounds].size.width now return the width according to the orientation of the device, and not the actual size of the device.

I will send this to another thread:

 - (BOOL) isIOS8OrAbove{ float version802 = 1140.109985; float version8= 1139.100000; // there is no def like NSFoundationVersionNumber_iOS_7_1 for ios 8 yet? NSLog(@"la version actual es [%f]", NSFoundationVersionNumber); if (NSFoundationVersionNumber >= version8){ return true; } return false; } 
+1
02 Oct '14 at 15:57
source share



All Articles