UIView.h

  1. @property(nonatomic) UIViewContentMode contentMode; // default is UIViewContentModeScaleToFill
  1. typedef NS_ENUM(NSInteger, UIViewContentMode) {
  2. UIViewContentModeScaleToFill,
  3. UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent
  4. UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped.
  5. UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)
  6. UIViewContentModeCenter, // contents remain same size. positioned adjusted.
  7. UIViewContentModeTop,
  8. UIViewContentModeBottom,
  9. UIViewContentModeLeft,
  10. UIViewContentModeRight,
  11. UIViewContentModeTopLeft,
  12. UIViewContentModeTopRight,
  13. UIViewContentModeBottomLeft,
  14. UIViewContentModeBottomRight,
  15. };

找资料的时候,找到这张图片,简单粗暴,直接拿来领悟一下就可以了。

特别提到:

aspect ratio (高宽比)

clipped to fill(裁剪填充)

在整理一下她们的定义:

  1. UIViewContentModeScaleAspectFit
  2. The option to scale the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the views bounds is transparent.
  3.  
  4. 这个选项用来缩放当前视图大小来保持当前视图的宽高比例不变,当前视图的其他的区域是透明的

捉襟见肘之UIView中contentMode属性的更多相关文章

  1. UIView 中 frame, bounds, center 属性的关系

    最近一直在学 iOS 开发,所以专门创建了这样一个类别,将自己学习中的一些问题整理,记录下来.由于自己是初学者,所以所写的文章非常基础,写这个类别一是为了给自己留下存 档,二是为了给和我有同样问题的初 ...

  2. [BS-24] UIImageView的contentMode属性

    UIImageView的contentMode属性   所有的UIView都有个contentMode属性,UIImageView继承自UIView,我们在使用UIImageView时,经常要考虑这些 ...

  3. UIView的常见属性

    UIView的常见属性: @interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDyn ...

  4. XCODE UITextField 中的属性和用法

    XCODE  UITextField  中的属性和用法 一些基本的用法 UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedR ...

  5. 格而知之2:UIView的autoresizingMask属性探究

    UIView的autoresizingMask属性,是用在当一个UIView实例的父控件的尺寸发生变化时,来自动调整UIView实例在父控件中的位置与尺寸的.autoresizingMask属性是一个 ...

  6. QF——UI之UIImageView及UIView的形变属性transform

    UIImageView: 专门用来放置图片的视图.它里面放置的图片是[UIImage imageNamed: (NSString) imgName]生成的,注意千万别只写成图片NSString类型的名 ...

  7. iOS开发之UIView的常见属性

    1.所有控件都继承自UIView,UIView的常见属性如下: @property(nonatomic,readonly) UIView *superview;获得自己的父控件对象 @property ...

  8. [iOS] UIView的clipsTobounds属性

    如题,有两个view: view1,view2view2添加view1到中,如果view2大于view1,或者view2的坐标不全在view1的范围内,view2是盖着view1的,意思就是超出的部份 ...

  9. iOS基础--UIView的常见属性

    UIView的常见属性以及方法 @property(nonatomic,readonly) UIView *superview; // 获得自己的父控件对象 @property(nonatomic,r ...

随机推荐

  1. Windows Server+AMD GPU+HDMI时_黑边_不铺满问题的解决办法

    HDMI接显示器或电视,有黑边或者被放大了是个很常见的问题,显卡设置界面里改下Scale或者Overscan/Underscan就行,可问题是WindowsServer版的CCC没有控制颜色对比度和缩 ...

  2. 关于浏览器URL中出现会话验证字符说明

    服务器安装了网站安全狗,访问网站的时候会显示一串类似iissafedogccsision=7Z86v5H5z这样的会话验证信息. 安全狗官方解释 出现该字符的主要原因是用户开启了网站安全狗的CC防护的 ...

  3. php 升级php5.5

    rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm yum install php55w php55w-opcache yum install ...

  4. Vware Workstation pro 12|虚拟机

    Vmware是比较不错的PC虚拟化软件,vmware11+不在支持32的系统安装!体积比之前小了很多 VMware 12 官方中文页面 http://vmware.com/cn/products/wo ...

  5. android 点亮屏幕与锁定屏幕

    PowerManager pm=(PowerManager) getSystemService(Context.POWER_SERVICE); //获取电源管理器对象 PowerManager.Wak ...

  6. openldap+phpadmin的搭建安装

    1.概念介绍 LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X.500标准的,但是简单多了并且可以根据 ...

  7. Edge detection using LoG

    intensity梯度值分布跟图片的大小有关, 比如将一张小图片放大后会变得很模糊, 原先清晰的edge, 即大的梯度值变得模糊. 但是原有的边缘通常还是肉眼可分辨的. 但用Sobel 算子可能就检测 ...

  8. Maven插件maven-surefire-plugin

    插件官方文档:maven-surefire-plugin 1.surefire plugin的作用surefire 插件用来在maven构建生命周期的test phase执行一个应用的单元测试. 它会 ...

  9. 100114B

    bfs #include<iostream> #include<queue> #include<cstring> #include<cstdio> us ...

  10. CocoaPods安装与使用

    CocoaPods简介: CocoaPods 是什么? CocoaPods 是开发 OS X 和 iOS 应用程序的一个第三方库的依赖管理工具.利用 CocoaPods,可以定义自己的依赖关系 (称作 ...