在iPhone X中拉伸的背景图片 [英] Background image stretching in iPhone X

查看:197
本文介绍了在iPhone X中拉伸的背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我们正在使用具有@ 1x,@ 2x和@ 3x的图像资产,它们将支持所有设备.但是,当我们为iPhone X使用相同的图像资源时,@ 3x图像在iPhone X中看起来像是张紧的. 因此,请让我知道如何为具有相同图像资产的iPhone X设备提供支持,或者是否有可用的解决方案来解决此问题.

Currently we are using image asset with @1x, @2x and @3x which will support for all devices. But when we use the same image asset for iPhone X, the @3x image looks stretched in iPhone X. So please let me know how to support for the iPhone X device with the same image asset or is there any solutions available to overcome this issue.

推荐答案

另一种选择是选择Aspect Fill.然后在属性检查器中向下选择Clip to Bounds.该图像将填满您的UIIMageView,但基于宽高比,将其裁剪以移除"图像中与视图不匹配的部分.

An alternative is to select Aspect Fill. Then lower down in attribute inspector select Clip to Bounds. The image will fill your UIIMageView, but based on the Aspect Ratio will clip it to "remove" that part of the image that doesn't fit the view.

唯一避免这种情况的方法是使图像的长宽比(宽度与高度)与UIImageView的长宽比相匹配.

The only way to avoid all of this is to have an image with an aspect ratio (width to height) that matches the aspect ratio of your UIImageView.

这篇关于在iPhone X中拉伸的背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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