Rotation of ViewController in TabbarController
I have a custom UIViewController in a UITabbarCont开发者_开发技巧roller and want to respond to rotation events. When a rotation occurs, the tabbarcontroller and the viewcontroller get rotated. However, the view in the viewcontroller doesn't get redrawn properly: the layout doesn't autoresize and it is black on parts of the screen.
The strange thing is that it works when I go to another tab and the back again to my original viewcontroller.
What could possibly be wrong? I checked that didRotateFromInterfaceOrientation:fromInterfaceOrientation
is being called. However, the view.frame.size
values are still the old ones from before the rotation. That's probably not correct.
Got it!
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
精彩评论