iPhone view controller view shifted down 20 pixels

2019-05-24 08:25发布

I am trying to implement a custom tabbarcontroller using a UIViewController and a UITabBar. Everything is working fine so far, except when I rotate the device to landscape, the UIViewController shifts the entire view down 20pixels, creating a black bar between the status bar and the view. Even when the view is rotated back to portrait orientation, the view is still shifted down 20pixels.

What do I need to do to remove the black bar? Do I have to perform custom rotations? If so, where should I insert these rotations?

Before rotation: enter image description here

After rotation: enter image description here

2条回答
小情绪 Triste *
2楼-- · 2019-05-24 08:48

Rather than shifting all views down, try DELTA properties in Interface builder.

enter image description here

查看更多
SAY GOODBYE
3楼-- · 2019-05-24 08:55

I've experienced this same issue.

This discussion was helpful: UIWebView on iPad size

Tony's answer helped me discover that when you create a subview it's helpful to setup code similar to this:

UIWebView *webView = [[UIWebView alloc] init];
webView.frame = self.view.bounds;

If you post some of your code I may be able to provide more specific advice.

查看更多
登录 后发表回答