UIImageView的contentMode属性
2015-09-10 18:32
387 查看
UIViewContentMode 都有哪些值:
默认值是 0,也就是:
一个个来理解下吧:
UIViewContentModeScaleToFill:表示完全填充在 frame 里。
UIViewContentModeScaleAspectFit:保持比例,都在 frame 内。
UIViewContentModeScaleAspectFill:保持比例,填满但 frame 外也有。
UIViewContentModeRedraw:每次设置或更改frame的时候自动调用drawRect.
其他的是相似的,好理解:
UIViewContentModeCenter:这个 image 的中心与 frame 的中心重合。
UIViewContentModeTop:这个 image 的上边缘与 frame 的上边缘重合。
UIViewContentModeBottom:这个 image 的下边缘与 frame 的下边缘重合。
UIViewContentModeLeft:这个 image 的左边缘与 frame 的左边缘重合。
UIViewContentModeRight:这个 image 的右边缘与 frame 的右边缘重合。
UIViewContentModeTopLeft:类似。
UIViewContentModeTopRight:类似。
UIViewContentModeBottomLeft:类似。
UIViewContentModeBottomRight:类似。
typedef NS_ENUM(NSInteger, UIViewContentMode) { UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped. UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay) UIViewContentModeCenter, // contents remain same size. positioned adjusted. UIViewContentModeTop, UIViewContentModeBottom, UIViewContentModeLeft, UIViewContentModeRight, UIViewContentModeTopLeft, UIViewContentModeTopRight, UIViewContentModeBottomLeft, UIViewContentModeBottomRight, };
默认值是 0,也就是:
UIViewContentModeScaleToFill
一个个来理解下吧:
UIViewContentModeScaleToFill:表示完全填充在 frame 里。
UIViewContentModeScaleAspectFit:保持比例,都在 frame 内。
UIViewContentModeScaleAspectFill:保持比例,填满但 frame 外也有。
UIViewContentModeRedraw:每次设置或更改frame的时候自动调用drawRect.
其他的是相似的,好理解:
UIViewContentModeCenter:这个 image 的中心与 frame 的中心重合。
UIViewContentModeTop:这个 image 的上边缘与 frame 的上边缘重合。
UIViewContentModeBottom:这个 image 的下边缘与 frame 的下边缘重合。
UIViewContentModeLeft:这个 image 的左边缘与 frame 的左边缘重合。
UIViewContentModeRight:这个 image 的右边缘与 frame 的右边缘重合。
UIViewContentModeTopLeft:类似。
UIViewContentModeTopRight:类似。
UIViewContentModeBottomLeft:类似。
UIViewContentModeBottomRight:类似。
相关文章推荐
- easyui datagrid自定义表头
- iOS开发之有趣的UI—— UITableView控件基本使用
- 在UITableViewCell上添加多行的UILabel
- windows 无法安装到这个磁盘,选中的磁盘具有MBR分区表。在EFI系统上,windows只能安装在GPT磁盘上
- 浅谈java Web中的request和response,以及转发和重定向的区别。
- 利用QtQuick实现UI的一个Demo
- easy ui 异步上传文件,跨域
- IOS开发,UINavigationController属性和基本用法详解
- HDU 3177 Crixalis's Equipment
- easyui
- 【Mockplus教程】备注
- 【Mockplus教程】页面属性
- 【Mockplus教程】如何创建页面的子页面?
- 【Mockplus教程】为什么删除多个页面的时候会有提示,如何取消提示?
- 【Mockplus教程】账号和购买
- UITextField 限制输入字数
- GUI架构方法
- druid连接池配置Druid
- POJ - 2031 Building a Space Station(最小生成树简单题)
- iBeacon 创建一个UUID