如何在UIImage中显示图像的一部分? [英] How to show in UIImage just a part of image?

查看:87
本文介绍了如何在UIImage中显示图像的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 UIImageView ,其中我正在显示50x100图像。

I have UIImageView in which I'm showing 50x100 image.

我只想显示一部分图像50x50(上部)?

I want to show only a part of image 50x50 (top part)?

我该怎么做?

推荐答案

我可能会为您提供解决方案。看看这是否有效。在Interface Builder中,有一个关于图像内容填充属性的选项。您可以将其设置为左上角。按照界面构建器中的图像进行操作 -

I might have a solution for you. See if this works. In Interface Builder there is an option about Image content fill properties. You can set it to top-left. Follow the image in interface builder -

此后将 UIImageView 的大小设置为50x50并选中clip-subviews...

After this set the size of UIImageView to 50x50 with "clip-subviews" checked...

这篇关于如何在UIImage中显示图像的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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