UIViews结束了标签栏下方 [英] UIViews ending up beneath tab bar

查看:116
本文介绍了UIViews结束了标签栏下方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我用自动布局对齐的标签从bottomLayoutGuide标准量。当第一次启动应用一切都奠定了,因为我想,但是当我切换标签,回到标签已在标签栏控制器下消失了。

In my app, I aligned a label the standard amount from the bottomLayoutGuide using autolayout. When the app first starts everything is layed out as I wanted but when I switch tabs and go back the label has disappeared under the tab bar controller.

如果我旋转设备,横向视图中显示正确,当我旋转回纵向视图恢复正常。我似乎无法找出是什么原因造成这种行为。感谢您的帮助!

If I rotate the device, the landscape view appears correctly and when I rotate it back to portrait the view is back to normal. I can't seem to figure out what is causing this behavior. Thanks for your help!

推荐答案

这恰好由于iOS7,有一个错误的底部布局指南错误地设置为0的高度,而不是标签栏的高度。当你旋转设备,底部布局引导设置是否正确。

This happens due to a bug in iOS7, where the bottom layout guide is incorrectly set to height 0 instead of the tab bar's height. When you rotate the device, the bottom layout guide is set correctly.

目前,最好的选择就是禁用底部延伸布局:

Currently, your best option is to disable bottom extended layout:

- (UIRectEdge)edgesForExtendedLayout
{
    return [super edgesForExtendedLayout] ^ UIRectEdgeBottom;
}

执行此操作为从标签栏控制器显示的每个视图控制器。请记住,标签栏视图控制器的背景颜色设置为任何适合您的应用。

Do this for each view controller that is displayed from the tab bar controller. Remember to set the tab bar view controller's background color to whatever suits your application.

请确保在 https://bugreport.apple.com

要详细多一点,似乎切换视图控制器时, viewDidLayoutSubviews 被调用了两次。第一次,所有设置都正确,但第二次底部布局指南高度为0,可以从堆栈跟踪的第一个来自标签栏的布局,而第二个电话是从计划CALayer的布局,这是不正确见

To elaborate a little more, it seems viewDidLayoutSubviews is called twice when switching view controllers. First time, everything is set correctly, but the second time bottom layout guide height is 0. You can see from the stack trace that the first one comes from tab bar layout, while the second call is from a scheduled CALayer layout, which is incorrect.

这篇关于UIViews结束了标签栏下方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆