Handling orientation for the previous UIViewController
I am developing an iPhone application. My active UIViewCon开发者_如何学运维troller is vc1. The shouldAutorotateToInterfaceOrientation method of vc1 returns YES and hence the device orientation is handled for its view automatically.
All the subviews added to this view has autoresizing masks set properly to fit the orientation.
The view's frame is not updated to fit the orientation for the following scenario:
- Push another UIViewController say vc2
- change the device orientation
- pop vc2
The new orientation is not reflected for view of vc1.
I can register for orientation change notification and manually set the frame to the view. Is there any way that handles this automatically?
I did the same. I don't think there is any way you can do this automatically.
You can probably send in a notification about the device orientation or you can check the current device orientation in ViewWillAppear
and set the frame accordingly.
What exactly is your app viewController structure? Make sure you are using a navigationController (you can have the navigationBar hidden if you like). Then it should just work.
精彩评论