正如标题所说。在iOS 9中,category中的所有方法(在UIViewController.h中):
@interface UIViewController (UIViewControllerRotation)
已被弃用。
所以问题是:How to detect UIViewController rotation events in iOS 9
最佳答案
iOS 8 检测方向变化(旋转)的方法正在实现 View Controller 的以下方法:
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
// Do view manipulation here.
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}
Note: The controller's view has not yet transitioned to that size at this time, so be careful if your sizing code relies on the view's current dimensions.
它还将应用iOS 9
关于iOS 9 将旋转至界面方向已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35913119/