willRotateToInterfaceOrientation method not called if returned from another view
Im running into alot of trouble just handling the device orientation in iPhone. I have to Add/Remove Hide/Unhide particular开发者_如何学运维ly the NavigationController's toolBar when the Device Orientation is changed
The scenario:
[Device in Portrait].
DetailViewController starts.. sets its view according to the orientation either Landscape or Portrait. (Now Portrait) in willRotateToInterfaceOrientation method.
Upon tapping a button, View is Pushed to a NewViewController. That also supports both portrait and Landscape. Now the device is turned to Landscape in NewViewController. Everythings fine. Heres the Problem, when tapping "Back" to DetailViewController (which was last seen in Portrait) doesnt make those hide/unhide changes when its in Landscape. Because, willRotateToInterface is not called at all. And its kinda not a good way to add a function in "ViewWillAppear".
to recape: DetailVeiwController(Portrait) --> PUSHED --> NewViewController(Portrait) -->Rotate--> NewVewController(Landscape) ---> PUSHED BACK-->DetailViewController (Landscape) (willRotate is not called in DetailViewController.
In such a case, whats the right way forward?? the right way. with minimum memory footprint.
Thanks :)
See How to handle rotation for a UIViewController that isnt on top of UINavigationController stack ?...
精彩评论