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.先看 ...
随机推荐
- vue中如何实现pdf文件预览?
今天产品提出一个优化的需求,就是之前我们做的图片展示就是一个img标签搞定,由于我们做的是海外后台管理系统,那边的人上传的文件时pdf格式,vue本事是不支持这种格式文件展示的,于是就google搜索 ...
- 一种跨平台的C++遍历目录的方法
参考了网络上各路大神的实现方法.主要使用了io.h库 #include <iostream> #include <cstring> #include <io.h> ...
- 【MySQL解惑笔记】忘记MySQL数据库密码
破解MySQL密码 一.MySQL5.7.5之前 只要有系统root密码就可以破解: [root@host- ~]# vim /etc/my.cnf //在配置文件中加入如下内容 [mysqld] s ...
- 3.azkaban3.0测试
测试目标 azkaban多executor下flow的分配方式 azkaban可以同时执行的flow\job个数 azkaban单个job最小使用的内存 相关配置 executor最大线程数: exe ...
- 阿里云搭建bind服务,外网ip不能用来解析问题解决
options { listen-on port 53 { any; }; //端口开放any listen-on-v6 port 53 { ::1; }; directory "/var/ ...
- 对编码内容多次UrlDecode
对编码内容多次UrlDecode,并不会影响最终结果. 尝试阅读了微软的源代码,不过不容易读懂. 网址:https://referencesource.microsoft.com/#System/ne ...
- jspSmartUpload上传下载使用例子
--------------------------------------------------------------------- ServletUpload.java 上传 package ...
- Firefox火狐浏览器 修改默认搜索引擎
如图:
- vue 开发多页应用
vue 开发多页应用 https://www.cnblogs.com/fengyuqing/p/vue_cli_webpack.html https://segmentfault.com/a/1190 ...
- 深入学习 Redis系列
深入学习 Redis(1):Redis 内存模型 深入学习 Redis(2):持久化 深入学习 Redis(3):主从复制 深入学习 Redis(4):哨兵