Nov 6, 2012

[Solved] iOS didrotatefrominterfaceorientation is not called

Posted Nov 6, 2012
There are cases that did rotate method (didRotateFromInterfaceOrientation:) of a view controller is not triggered. A workaround is to manually call it from you main view controller, but if you don't have time, an easier fix is to use notifications:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];

Place the above in your controllers view will appear, and don't forget to unregister it in view did disappear.

- (void)didRotate:(NSNotification *)notification {
  //do your post-rotation logic here

}

3 comments:

  1. Thanks Dear its very help full in the case of ios 6 rotation
    once again thank you very much

    ReplyDelete
  2. Very helpful - thanks!

    ReplyDelete