Showing posts with label autorotation does not work on ios 6. Show all posts
Showing posts with label autorotation does not work on ios 6. Show all posts

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

}