旋转至横向时,iPhone视图控制器视图向下移动20像素
我正在尝试使用UIViewController和UITabBar实现自定义的tabbarcontroller.到目前为止,一切工作正常,除非我将设备旋转到横向,否则UIViewController会将整个视图下移20像素,从而在状态栏和视图之间创建一个黑条.即使将视图旋转回纵向,该视图仍会向下移动20像素.
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?
旋转前:
旋转后:
我也遇到过同样的问题.
I've experienced this same issue.
此讨论很有帮助: iPad尺寸的UIWebView
Tony 的答案帮助我发现,在创建子视图时,设置类似于以下内容的代码会很有帮助:
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.