开发者

Rotation of ViewController in TabbarController

开发者 https://www.devze.com 2022-12-25 23:09 出处:网络
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

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;
0

精彩评论

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