iOS 5.1 shouldAutorotateToInterfaceOrientation:调用但didRotateFromInterfaceOrientation:不是第一次加载

时间:2013-03-04 17:07:30

标签: ios objective-c ios5.1

所以看起来我第一次将UIVIewController推送到我的UINavigationController堆栈时调用了这个方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

但这种方法不是:

-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation

现在,如果我在加载UIViewContoller后旋转设备,则会按预期触发这两个设备。

为什么在我的控制器加载时没有调用didRotateFromInterfaceOrientation

1 个答案:

答案 0 :(得分:0)

来自UIViewController Class Reference

  

didRotateFromInterfaceOrientation:

     

用户界面旋转后发送到视图控制器。

didRotateFromInterfaceOrientation在加载期间未被调用,因为没有用户界面轮换。

在每次轮换之前调用

shouldAutorotateToInterfaceOrientation。我不确定为什么在加载过程中调用它。我认为这可能是UINavigationViewController使用的某些性能优化提示的问题。