gpt4 book ai didi

ios - 边界上的 UIViewController 已更改

转载 作者:行者123 更新时间:2023-12-01 18:11:48 25 4
gpt4 key购买 nike

我需要一种方法来检测 UIViewController 的边界何时更改(例如,当手机旋转时)

对于 UIView 我这样做:

 -(void)setBounds:(CGRect)newBounds

最佳答案

使用的方法记录在 UIViewController 类引用的“处理 View 旋转”部分中,

In iOS 8, all rotation-related methods are deprecated. Instead, rotations are treated as a change in the size of the view controller’s view and are therefore reported using the viewWillTransitionToSize:withTransitionCoordinator: method. When the interface orientation changes, UIKit calls this method on the window’s root view controller. That view controller then notifies its child view controllers, propagating the message throughout the view controller hierarchy.

关于ios - 边界上的 UIViewController 已更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29465752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com