How to show in UIImage just a part of image?(如何在 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 中只显示图像的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 UIImage 中只显示图像的一部分?


- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01