0

So it looks like the first time I push a UIVIewController to my UINavigationController stack this method is called:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

But this method is not:

-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation

Now if I rotate the device after the UIViewContoller is loaded then both of these are fired as expected.

Why is didRotateFromInterfaceOrientation not being called when my controller loads?

Slee
  • 27,498
  • 52
  • 145
  • 243

1 Answers1

0

From UIViewController Class Reference:

didRotateFromInterfaceOrientation:

Sent to the view controller after the user interface rotates.

didRotateFromInterfaceOrientation is not being called during load because there was no user interface rotation.

shouldAutorotateToInterfaceOrientation is called before every rotation. I am not sure why it's called during load. I think it could be a matter of some performance optimalization hint used by UINavigationViewController.

Michal Pietras
  • 442
  • 5
  • 16