iOS 9 将旋转至界面方向已弃用

标签 ios uiviewcontroller deprecated

正如标题所说。在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

来源:https://stackoverflow.com/a/27700245/2963912

关于iOS 9 将旋转至界面方向已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35913119/

相关文章:

ios - 在 ScrollView Swift 中忽略 Superview 的尾随空间

android - 在没有应用程序的情况下测试 firebase 云消息传递

swift - 在 ViewController 之间传递 NSString

ios - 为什么 iOS 在 didReceiveMemoryWarning 释放后不自动旋转从 Nib 加载的 View ?

android - 在 androidx 中弃用 OnActivityResult()

java - 如何修复已弃用的 oracle.sql.ArrayDescriptor、oracle.sql.STRUCT 和 oracle.sql.StructDescriptor

ios - Swift - 已完成的 Game Center 成就

ios - UIPageViewController 委托(delegate)不触发横向

ios - 运行 Non-Storyboard 应用程序的运行时错误

c++ - 为什么我不能使用 fopen?