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

查看:18
本文介绍了如何在 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 中有一个关于图像内容填充属性的选项.您可以将其设置为 top-left.按照界面生成器中的图像 -

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天全站免登陆