UIViewContentMode的各种效果:
 
首先它是枚举类型的数据,表示为下所示:
typedef enum {

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的各种效果的更多相关文章

  1. UIViewContentMode各类型效果

    UIViewContentMode   typedef enum {    UIViewContentModeScaleToFill,    UIViewContentModeScaleAspectF ...

  2. 图片在View中的几种填充方式

    UIViewContentMode各类型效果   UIViewContentMode typedef enum {     UIViewContentModeScaleToFill,     UIVi ...

  3. 关于Mongodb的全面总结

    MongoDB的内部构造<MongoDB The Definitive Guide> MongoDB的官方文档基本是how to do的介绍,而关于how it worked却少之又少,本 ...

  4. Swift 2.0 封装图片折叠效果

    文/猫爪(简书作者)原文链接:http://www.jianshu.com/p/688c491580e3著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”. 用Swift封装图片折叠效果 b ...

  5. UIViewContentMode 图文解说

    在iOS应用开发中我们常常要对视图的contentMode属性进行设置,尤其在使用UIImageView视图时设置这个属性的概率很高.我们知道contentMode的类型是UIViewContentM ...

  6. iOS的GIF动画效果实现

    引言:GIF图像格式是常见的一种动态图片格式,无论是在Web端还是在移动端都经常遇到,但是考虑目前iOS还无法原生展现GIF图片,而对于GIF的原生支持暂时也没有像JPG.PNG等图像格式支持得这么全 ...

  7. Swift - 多个mask的动画效果

    Swift - 多个mask的动画效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TranformFadeView.swi ...

  8. 如何创建一个非常酷的3D效果菜单

    http://www.cocoachina.com/ios/20150603/11992.html 原文地址在这里.原文 去年,读者们投票选出了Top5的iOS7最佳动画,当然也很想看到有关这些动画如 ...

  9. 纯CSS3实现的一些酷炫效果

    之前在网上看到一些用纯CSS3实现的酷炫效果,以为实现起来比较困难,于是想看看具体是怎么实现的. 一.笑脸猫动画 实现效果如下: 这个实现起来确实比较麻烦,很多地方需要花时间,有耐心地调整. 1.先看 ...

随机推荐

  1. NGUI组件整理总结

    一图流: 注意: private void RClickUI(Vector3 newPos) { this.gameObject.SetActive(true); this.transform.loc ...

  2. Android softkeyboard 和 其他界面关系 softInputMode

    转 : http://blog.csdn.net/xww810319/article/details/17397429 and http://blog.csdn.net/harryweasley/ar ...

  3. 使用flask_limiter设定API配额

    前言 闲来无事,突然想到了以前做过的关于后台API安全方面的事,关于接口访问配额的设置,flask有没有很好的库支持呢?一找还真有!主要是对照了库的官方文档自己写了下dome,以供参考. # -*- ...

  4. JVM学习--jvm监控和故障处理工具

    java虚拟机性能监控常用命令 Sun JDK监控和故障处理命令有jps.jstat.jinfo.jmap.jhat.jstack . 1.jps jps:JVM Process Status Too ...

  5. 日历(Calendar)模块

    #usr/bin/python3 #! -*-conding : utf-8 -*- #2018.3.14 """ 日历(Calendar)模块 此模块的函数都是日历相关 ...

  6. OpenMPI运行问题:enough slots available in the system

    版本: Open MPI 3.0.1 编译好可执行的C语言程序后,使用 mpirun -np 3 Test 命令,发现没有正常运行,而是报错: There are not enough slots a ...

  7. Laxcus大数据管理系统2.0(6)- 第四章 数据计算

    第四章 数据计算 Laxcus所有数据计算工作都是通过网络实施.相较于集中计算,在网络间进行的数据计算更适合处理那些数据量大.复杂的.耗时长的计算任务.能够实施网络计算的前提是数据可以被分割,就是把一 ...

  8. 关于wcf服务编译平台是x86, 运行平台是x64时,如何调试

    关于调试CTDC项目中的的 wcf服务时注意事项: 因为wcf项目引用的的 x86的程序集,所以wcf生成的目标平台为x86.故在64系统上调试需要执行下面的脚本 具体操作步骤: 1. 必须使用201 ...

  9. LeetCode 169. Majority Element - majority vote algorithm (Java)

    1. 题目描述Description Link: https://leetcode.com/problems/majority-element/description/ Given an array ...

  10. [leetcode-753-Open the Lock]

    You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', ...