iOS 8 Rotation Methods Deprecation - Backwards Compatibility

后端 未结 6 1555
谎友^
谎友^ 2020-11-27 02:35

In iOS 8, the methods for interface rotation are deprecated. This includes:

  • willRotateToInterfaceOrientation:duration:
  • didRotateFro
6条回答
  •  面向向阳花
    2020-11-27 03:21

    The deprecated rotation methods you've listed are still called when the app is run on iOS 8+ devices. If you are supporting iOS 7, you may continue to use them without issue. If you are only supporting iOS 8+, it would be wise to use the non-deprecated methods instead.

    However, do note that if you implement the new rotation methods and the deprecated ones in the same view controller, when run on iOS 7 the deprecated methods will be called, and on iOS 8+ it will only call the new methods that have replaced those that are deprecated.

    For example, if you only implement willRotateToInterfaceOrientation, this method will be called when run 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.

提交回复
热议问题