Iphone 模态viewcontroller上的内存警告和旋转

Iphone 模态viewcontroller上的内存警告和旋转,iphone,ios,ipad,Iphone,Ios,Ipad,大家好 我有一个自定义的ViewController(1)和另一个ViewController(2)。 显示模式ViewController(2)时,它收到内存警告和更改方向。 之后,我取消了模态ViewController(2) 我检查了ViewController(1)上回调函数的顺序 willRotateToInterfaceOrientation 负荷视图 viewDidLoad WillAnimateRotationInterfaceOrientation 双旋转面间定向 在加载视图

大家好

我有一个自定义的ViewController(1)和另一个ViewController(2)。 显示模式ViewController(2)时,它收到内存警告更改方向。 之后,我取消了模态ViewController(2)

我检查了ViewController(1)上回调函数的顺序

  • willRotateToInterfaceOrientation
  • 负荷视图
  • viewDidLoad
  • WillAnimateRotationInterfaceOrientation
  • 双旋转面间定向
  • 在加载视图之前调用willRotateToInterfaceOrientation函数是否正常?那有什么关系?如果结果正确,将首先调用willRotateToInterfaceOrientation

    不过,这并不是什么大问题:如果您需要访问willRotateToInterfaceOrientation中的视图,只需确保在代码中访问
    [self view]
    self.view
    。如果视图尚未加载,则将立即加载,在将控件返回willRotateToInterfaceOrientation之前,根据需要调用loadView和viewDidLoad

    如果设置了在视图加载时连接的插座(可能),只需插入
    [self view]强制加载视图,并在视图返回时连接插座。然后可以调用
    self.bigButton.enabled=NO或任何您想做的事情