开发者

UINavigation Controller and Autorotation

I am using a UINavigationController to push and pop views. The Navigation bar is hidden.

I have RootViewController, which is set to autorotate. It works just fine when it is visible. I also have GalleryViewController. It has autorotation disabled by just returning no.


My problem is, when GalleryViewController is on the nav stack, RootViewController stops responding to it's autorotate events.


If I am in Portrait, and I rotate the device (while viewing GalleryViewController) and then tap the back button, it pops the GalleryViewController off the stack and reveals the RootViewController, but RootViewController did not change rotation as it should have.

I stuck in the method -viewWillAppear and checked the status of the UIDevice orientation. It gives me the correct orientation for the device.

BTW, I also tried enabling the autorotate in the GalleryViewController. It then rotates the view correctly but still does not rotate the RootViewController.


It seem开发者_C百科s that when using the navigation controller, only the top of the stack gets rotated.


QUESTION: Since the device knows it's in the correct rotation when -viewWillAppear is called, can I force it to update somehow??

-mark


instead of returning just YES, return (interfaceOrientaion == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || and so on...) in the RootViewController.

in the GalleryViewController return only one orientation which in our opinion is the default one.

When thus done - everything should work like you want it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜