UITabBar selectionIndicator iPhone X上的图像高度 [英] UITabBar selectionIndicatorImage height on iPhone X

查看:103
本文介绍了UITabBar selectionIndicator iPhone X上的图像高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为UITabBar使用selectionIndicatorImage,它的高度为49点,如下所示:UITabBar.appearance().selectionIndicatorImage = UIImage(named: "bg-tab-selected")

I'm using a selectionIndicatorImage for a UITabBar, which is 49 points high, like this: UITabBar.appearance().selectionIndicatorImage = UIImage(named: "bg-tab-selected")

在所有设备上都能正常工作:

Works just fine across all devices:

iPhone X除外:

Except for the iPhone X:

我尝试将图像设置为仅在资产目录中垂直切片,但这似乎并没有达到预期的效果.由于某种原因,它也会水平延伸吗?而且顶部还有一些填充.

I've tried setting the images to be vertically sliced only in the asset catalog, but that doesn't seem to have the desired effect. For some reason it also stretches horizontally? And there is a bit of padding on top.

有什么想法我可以解决这个问题吗?

Any ideas how I can fix this?

推荐答案

我遇到了同样的问题.我通过将高度减去1个像素来固定"它,因此选择图像的高度为48个像素.似乎是iPhone X的错误.

I had the same issue. I "fixed" it by subtracting the height by 1 pixel, so 48 pixels for the height of the selection image. It seems to be an iPhone X bug.

这篇关于UITabBar selectionIndicator iPhone X上的图像高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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