iphone - 旋转后获取 UIViewController View 的大小

标签 iphone objective-c ios ios4

我有一个带有一堆 subview 的 UIViewController,如果 iPad 处于纵向或横向模式,我需要以不同的顺序进行布局。我希望能够获取 UIViewController 的 View 在旋转后将转换成的大小,以便我可以为我的 subview 计算新的帧集。但是,我还没有找到任何方法在旋转发生之前获得这个新尺寸,并且当旋转发生时已经太晚了,因为我无法将 subview 转换到它们的新位置的动画。

有人知道解决这个问题的方法吗?

最佳答案

您是否尝试过willAnimateRotationToInterfaceOrientation:duration:。正如文档所述:

By the time this method is called, the interfaceOrientation property is already set to the new orientation. Thus, you can perform any additional layout required by your views in this method.

我相信 View Controller 的 View 也应该在这个方法中有它的新维度。

关于iphone - 旋转后获取 UIViewController View 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4432463/

相关文章:

iphone - Ipad/iPhone 字体无法正确呈现

iphone - NSUnknownKeyException View ...该怎么办?

objective-c - 图像缩略图的坐标计算

ios - 在 Objective-C 中创建仅对子类可见的属性

ios - 当有多个 APN 堆叠时,如何获取 APN 的有效负载?

ios - Theos实例方法调用

ios - 如何在 IOS 中滚动表格 View 时隐藏导航栏和标签栏

ios - 在 Objective-C 中的方法之间传递信息

objective-c - UITableViewCell<MFMailComposeViewControllerDelegate> 崩溃 didReceiveMemoryWarning

ios - 使用远程图像创建 MSSticker