UIView.h

@property(nonatomic) UIViewContentMode contentMode; // default is UIViewContentModeScaleToFill
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,
};

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

特别提到:

aspect ratio (高宽比)

clipped to fill(裁剪填充)

在整理一下她们的定义:

UIViewContentModeScaleAspectFit:
The option to scale the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.

这个选项用来缩放当前视图大小来保持当前视图的宽高比例不变,当前视图的其他的区域是透明的

捉襟见肘之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. Metatable让我从心认知了Lua(相知篇)

    自从在公司和Lua第一次相遇之后,我的IT生涯从此也开启了另一个新篇... 起初并没有和Lua产生相遇时的那种电石火花般的怦然心动...但... 说实话虽然我的心没有因此触动但至少也不排斥...因为公 ...

  2. 如何在Vue2中实现组件props双向绑定

    Vue学习笔记-3 前言 Vue 2.x相比较Vue 1.x而言,升级变化除了实现了Virtual-Dom以外,给使用者最大不适就是移除的组件的props的双向绑定功能. 以往在Vue1.x中利用pr ...

  3. Windows 10 后台音频

    UWP版本的网易云音乐已经上架,虽然还不支持Windows Phone但是整体而言功能已经比较齐全了! 那么如何在Windows 10 UWP实现后台播放呢? 我之前是一直在做Windows Phon ...

  4. Linux epoll 笔记(高并发事件处理机制)

    wiki: Epoll优点: Epoll工作流程: Epoll实现机制: epollevent; Epoll源码分析: Epoll接口: epoll_create; epoll_ctl; epoll_ ...

  5. Linq连接查询之左连接、右连接、内连接、全连接、交叉连接、Union合并、Concat连接、Intersect相交、Except与非查询

    内连接查询 内连接与SqL中inner join一样,即找出两个序列的交集 Model1Container model = new Model1Container(); //内连接 var query ...

  6. Redis的五种数据结构

    Redis支持持久化只是它的一件武器,它提供了多达5种数据存储方式: 一  string(字符串) string是最简单的类型,你可以理解成与Memcached一模一样的类型,一个key对应一个val ...

  7. 【BZOJ1003】【ZJOI2006】物流运输

    1003: [ZJOI2006]物流运输trans Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 2556  Solved: 1008[Submit] ...

  8. leetcode-Warm Up Contest-Aug.21

    leetcode   地址: https://leetcode.com/contest/detail/1 (1)-- Lexicographical Numbers Given an integer  ...

  9. Mod4-PHP编码规范

    loading... 归纳总结了能找到的一些编码规范,形成自己所需要的编码规范. 参考网址:1.2 一.文件格式 缩进使用四个空格,不使用制表符.左花括号不另起一行. if (1 == $x) { $ ...

  10. Linux系统日志

    日 志 文 件 说    明 /var/log/message 系统启动后的信息和错误日志,是Red Hat Linux中最常用的日志之一 /var/log/secure 与安全相关的日志信息 /va ...