我想shouldAutorotateToInterfaceOrientation
在 UIViewController 中调用函数之前进行一些初始化。然而,在不同的函数中添加一些打印输出之后,这些函数显然被调用的顺序如下:
1.-shouldAutorotateToInterfaceOrientation
2.-loadView
3.-viewDidLoad
4.- shouldAutorotateToInterfaceOrientation
(再次)
5.-viewWillAppear
...
init
此外,这些函数initWithNibName
永远不会被调用(或者至少我永远不会得到打印输出)。
我认为init
or initWithNibName
(取决于您使用的方法)应该在之前调用shouldAutorotateToInterfaceOrientation
。但我想我错了(或者我做错了什么?)。也许这是因为这个视图控制器在故事板编辑器中被标记为“是初始视图控制器”?
无论如何,之前shouldAutorotateToInterfaceOrientation
在 UIViewController 中自动调用的函数是什么?
太感谢了!
注意:我知道shouldAutorotateToInterfaceOrientation
自 6.0 以来已过时,但我希望我的应用程序也与 5.0 兼容。
编辑:我只想在之前初始化一些变量shouldAutorotateToInterfaceOrientation
,而且我只想这样做一次,而不是每次都shouldAutorotateToInterfaceOrientation
被调用。