iOS 11 iPhone X模拟器UITabBar图标和标题在顶部覆盖彼此 [英] iOS 11 iPhone X simulator UITabBar icons and titles being rendered on top covering eachother

查看:847
本文介绍了iOS 11 iPhone X模拟器UITabBar图标和标题在顶部覆盖彼此的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人在UITabBar组件周围遇到iPhone X模拟器问题?

Anyone having issue with the iPhone X simulator around the UITabBar component?

我似乎将图标和标题呈现在彼此之上,我不是确定如果我遗漏了任何东西,我也会在iPhone 8模拟器中运行它,并且在故事板上显示它看起来很好的一个实际设备。

Mine seem to be rendering the icons and title on top of each other, I'm not sure if I'm missing anything, I also ran it in the iPhone 8 simulator, and one actual devices where it looks fine just as shown on the story board.

iPhone X:

iPhone 8

推荐答案

我能够通过在viewDidLayoutSubviews中的UITabBar上调用invalidateIntrinsicContentSize来解决这个问题。

I was able to get around the problem by simply calling invalidateIntrinsicContentSize on the UITabBar in viewDidLayoutSubviews.

-(void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    [self.tabBar invalidateIntrinsicContentSize];
}

注意:标签栏的底部需要包含在底部主视图,而不是安全区域,标签栏应该没有高度约束。

Note: The bottom of the tab bar will need to be contained to the bottom of the main view, rather than the safe area, and the tab bar should have no height constraint.

这篇关于iOS 11 iPhone X模拟器UITabBar图标和标题在顶部覆盖彼此的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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