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 中只显示图像的一部分?
基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
