如何在不拉伸中心的情况下拉伸UIImageView? [英] How to stretch a UIImageView without stretching the center?

查看:189
本文介绍了如何在不拉伸中心的情况下拉伸UIImageView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要拉伸上图所示图片的左右两侧,并保持中间箭头未拉伸。我该怎么做?

I want to stretch the left and right sides of the picture shown above, and keep the middle arrow unstretched. How can I do that?

推荐答案

使用Photoshop或其他图像编辑工具将图像分成两部分:边缘和中心。边缘图像可以是一个像素宽并用于左右边缘;然而,中心有很多像素宽,可以捕捉箭头。然后,您可以将三个 UIImageView 实例彼此相邻:左边缘,中心边缘和右边缘。左右边缘调整为所需宽度,而中心保持原始尺寸。

Use Photoshop or another image editing tool to split the image into two pieces: edge and center. The edge image can be one pixel wide and used for left and right edges; the center is however many pixels wide that capture the arrow. You can then put three UIImageView instances next to each other: left edge, center, and right edge. The left and right edges are resized to the desired width, while the center keeps its original dimensions.

这篇关于如何在不拉伸中心的情况下拉伸UIImageView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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