旋转到横向时 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?
Before rotation:
After rotation:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也经历过同样的问题。
此讨论很有帮助:iPad 上的 UIWebView 尺寸
托尼的回答帮助我发现,当您创建子视图时,设置与此类似的代码很有帮助:
如果您发布一些代码,我可能可以提供更具体的信息建议。
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:
If you post some of your code I may be able to provide more specific advice.
不要将所有视图向下移动,而是尝试界面构建器中的 DELTA 属性。
Rather than shifting all views down, try DELTA properties in Interface builder.