Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't understand rotation mechanism in iOS6

My app has view controllers subclassing shouldautorotateToInterfaceOrientation. And in it, I decides each view's rotation. This works correctly. But in iOS6, though I read documents provided Apple, I can't understand it.

My app has navigation controller as root view controller. This navigation controller has tab controller. And the tab controller has some view controllers. I want the first view controller (in tab controller) viewed only as portrait mode and the second view controller (in tab controller) viewed both portrait and landscape mode. It works correctly in iOS5. But I don't know how to make it in iOS6. Although I know I should subclass supportedInterfaceOrientations, it doesn't work when rotation happen. To my surprise it is called when a view is showing. How to make what I want?

Thank you for reading.

like image 851
eon Avatar asked Oct 01 '12 07:10

eon


1 Answers

The following link might steer you to the right direction: http://code.shabz.co/post/32051014482/ios-6-supportedorientations-with-uinavigationcontroller

Basically, you need to subclass UINavigationController and have it listen to changes in -supportedInterfaceOrientations of its topViewController. There is a sample class you can download in the blog post and also explains what code to add.

like image 57
shabbirv Avatar answered Nov 20 '22 05:11

shabbirv