UIViewContentMode的各种效果
UIViewContentModeScaleToFill, // default value
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,
} UIViewContentMode;
各种展示效果:
默认值是:0,也就是,UIViewContentModeScaleToFill
一个个来理解下吧:
- UIViewContentModeScaleToFill:表示完全填充在 frame 里。
- UIViewContentModeScaleAspectFit:保持比例,但都在 frame 内。
- UIViewContentModeScaleAspectFill:保持比例,且必须填满,但 frame 外也有,所以,frame只会把部分图片显示出来。
其他的是相似的,按照字面意思去理解就OK啦:
- UIViewContentModeCenter:这个 image 的中心与 frame 的中心重合。
- UIViewContentModeTop:这个 image 的上边缘与 frame 的上边缘重合。
- UIViewContentModeBottom:这个 image 的下边缘与 frame 的下边缘重合。
- UIViewContentModeLeft:这个 image 的左边缘与 frame 的左边缘重合。
- UIViewContentModeRight:这个 image 的右边缘与 frame 的右边缘重合。
- UIViewContentModeTopLeft:类似。
- UIViewContentModeTopRight:类似。
- UIViewContentModeBottomLeft:类似。
- UIViewContentModeBottomRight:类似。
UIViewContentMode的各种效果的更多相关文章
- UIViewContentMode各类型效果
UIViewContentMode typedef enum { UIViewContentModeScaleToFill, UIViewContentModeScaleAspectF ...
- 图片在View中的几种填充方式
UIViewContentMode各类型效果 UIViewContentMode typedef enum { UIViewContentModeScaleToFill, UIVi ...
- 关于Mongodb的全面总结
MongoDB的内部构造<MongoDB The Definitive Guide> MongoDB的官方文档基本是how to do的介绍,而关于how it worked却少之又少,本 ...
- Swift 2.0 封装图片折叠效果
文/猫爪(简书作者)原文链接:http://www.jianshu.com/p/688c491580e3著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”. 用Swift封装图片折叠效果 b ...
- UIViewContentMode 图文解说
在iOS应用开发中我们常常要对视图的contentMode属性进行设置,尤其在使用UIImageView视图时设置这个属性的概率很高.我们知道contentMode的类型是UIViewContentM ...
- iOS的GIF动画效果实现
引言:GIF图像格式是常见的一种动态图片格式,无论是在Web端还是在移动端都经常遇到,但是考虑目前iOS还无法原生展现GIF图片,而对于GIF的原生支持暂时也没有像JPG.PNG等图像格式支持得这么全 ...
- Swift - 多个mask的动画效果
Swift - 多个mask的动画效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TranformFadeView.swi ...
- 如何创建一个非常酷的3D效果菜单
http://www.cocoachina.com/ios/20150603/11992.html 原文地址在这里.原文 去年,读者们投票选出了Top5的iOS7最佳动画,当然也很想看到有关这些动画如 ...
- 纯CSS3实现的一些酷炫效果
之前在网上看到一些用纯CSS3实现的酷炫效果,以为实现起来比较困难,于是想看看具体是怎么实现的. 一.笑脸猫动画 实现效果如下: 这个实现起来确实比较麻烦,很多地方需要花时间,有耐心地调整. 1.先看 ...
随机推荐
- SQL学习(时间,存储过程,触发器)
SQL学习 几个操作时间的函数 --datapart 获取时间中的年月日时分秒等部分 select DATEPART(year,current_timestamp); select DATEPART( ...
- Django学习总结②----关系运算与F,Q关系
关联mysql步骤: 第一步:下载pymysql:pip install pymysql 第二步:在工程目录下的init文件下,将pymysql引入 import pymysql pymysql.in ...
- [SHELL]输出目录下所有的可执行文件,批量创建用户
#!/bin/bash IFS=: for folder in $PATH #PATH变量分隔符为: do echo $folder echo ------------------ for file ...
- 解决CentOS: Failed to start The Apache HTTP Server.
使用systemctl status httpd.service命令查看服务状态,发现有报错 然后将此配置文件/etc/httpd/conf.d/wordpress.conf的内容全部清空,修改为: ...
- 57[LeetCode] Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessa ...
- OpenPAI大规模人工智能平台安装部署文档
环境要求: 如果需要图形界面,需要在Ubuntu系统安装,否则centos系统安装时是没有问题的(web端和命令行进行任务提交) 安装过程需要有另外一台控制端机器(注意:区别于集群所在的任何一台服务器 ...
- leetcode个人题解——#8 string to integer
第八题 class Solution { public: int myAtoi(string str) { ; ; ; while(str[i] == ' ')i++; if (str[i] == ' ...
- 十一:Centralized Cache Management in HDFS 集中缓存管理
集中的HDFS缓存管理,该机制可以让用户缓存特定的hdfs路径,这些块缓存在堆外内存中.namenode指导datanode完成这个工作. Centralized cache management i ...
- C中的除法,商和余数的大小、符号如何确定
对于C中的除法,商和余数的大小.符号是如何确定的呢?在C89中,只规定了如果两个数为正整数,那么余数的符号为正,并且商的值是接近真实值的最大整数.比如5 / 2,那么商就是2,余数就是1.但是,C89 ...
- 定点数(fixed-point number)
定义 定点数(fixed-point number)就是小数点位置固定的数,也就是说,小数点后面的位数是固定的,比如要记录一笔账目,这些账目的数字都不会超过100,就可以使用2位小数位定点数来记录,比 ...