在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高。

1
2
3
4
5
6
7
8
9
enum {
   UIViewAutoresizingNone                 = 0,
   UIViewAutoresizingFlexibleLeftMargin   = 1 << 0,
   UIViewAutoresizingFlexibleWidth        = 1 << 1,
   UIViewAutoresizingFlexibleRightMargin  = 1 << 2,
   UIViewAutoresizingFlexibleTopMargin    = 1 << 3,
   UIViewAutoresizingFlexibleHeight       = 1 << 4,
   UIViewAutoresizingFlexibleBottomMargin = 1 << 5
};

UIViewAutoresizingNone:就是不自动调整,即不使用自动调整,不会随superView的大小改变而改变。
UIViewAutoresizingFlexibleLeftMargin: 自动调整自己的左边与superView左边的距离,以保证自己的右边与superView右边的距离不变。
UIViewAutoresizingFlexibleRightMargin:自动调整自己的右边与superView的右边距离,以保证自己的左边与superView左边的距离不变。
UIViewAutoresizingFlexibleTopMargin:自动调整自己的顶部与superView顶部的距离,以保证自己的底部与superView底部的距离不变。
UIViewAutoresizingFlexibleBottomMargin:自动调整自己的底部与superView底部的距离,以保证自己的顶部与superView顶部的距离不变。
UIViewAutoresizingFlexibleWidth:自动调整自己的宽度,以保证自己的左边、右边与superView左边、右边的距离不变。
UIViewAutoresizingFlexibleHeight:自动调整自己的高度,以保证自己的顶部、底部与superView顶部、底部的距离不变。

autoresizingMask的组合使用: 也就是枚举中的值可以使用 | 隔开同时多个使用,以同时拥有多个值所指示动功能,这样,可以针对不同的场景作不同的变化。

举例:

UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin:自动调整subview的宽度,以保证subview的左边、右边与其superView的左边、右边的距离不变,并自动调整subview的底部与superView底部的距离,以保证subview的顶部与其superView顶部的距离不变。

其他的组合类似

UIView的autoresizingMask属性研究的更多相关文章

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

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

  2. 关于UIView 的autoresizingMask属性,即UIViewAutoresizing

    enum {   UIViewAutoresizingNone                 = 0,   UIViewAutoresizingFlexibleLeftMargin   = 1 &l ...

  3. UIView 的 autoresizingMask 属性 详解。

    转载自:liubo0_0的专栏  链接网址:http://blog.csdn.net/liubo0_0/article/details/7085935 在 UIView 中有一个autoresizin ...

  4. UIView 的autoresizingMask属性

    autoresizingMask属性的意思就是自动调整子控件与父控件中间的位置,宽高,定义如下: typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) ...

  5. 关于UIView的AutoresizingMask属性的研究

    在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. 1 2 3 4 5 6 7 8 9 enum  ...

  6. 关于UIView的autoresizingMask属性的研究【转】

    在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. 1 2 3 4 5 6 7 8 9 enum  ...

  7. ios开发之--关于UIView的autoresizingMask属性的研究

    在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. enum { UIViewAutoresizi ...

  8. 转-关于UIView的autoresizingMask属性的研究

    在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. 1 2 3 4 5 6 7 8 9 enum  ...

  9. UIView的autoresizingMask属性

    今天做相册列表的时候,发现有些 UITableViewController 属性不好记忆,然后就查找了一些资料.做一下备份. 在 UIView 中有一个autoresizingMask的属性,它对应的 ...

随机推荐

  1. SGU 194 Reactor Cooling(无源无汇上下界可行流)

    Description The terrorist group leaded by a well known international terrorist Ben Bladen is bulidin ...

  2. POJ 1679 The Unique MST(最小生成树)

    Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definit ...

  3. Easy Summation

    Description You are encountered with a traditional problem concerning the sums of powers. Given two ...

  4. WPF+数据库+三层

    1.计算类 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespac ...

  5. 将代码上传到GitHub

    网上看了很多资料,都是用的命令行,比较难看懂,自己摸索了一下怎么样在图形界面上操作.下面记录的只是简单的如何把本地仓库直接上传到服务器上. 在mac上下载个GitHub Mac客户端,安装好后运行,输 ...

  6. HDU 5816 Hearthstone 概率dp

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5816 Hearthstone Time Limit: 2000/1000 MS (Java/Othe ...

  7. 《学习OpenCV》课后习题解答5

    题目:(P104) 为一个图像创建多个图像头.读取一个大小至少为100*100的图像.另创建两个图像头并设置它们的origion,depth,nChannels和widthStep属性同之前读取的图像 ...

  8. 【Docker 命令】- attach命令

    docker attach :连接到正在运行中的容器. 语法 docker attach [OPTIONS] CONTAINER 要attach上去的容器必须正在运行,可以同时连接上同一个contai ...

  9. Jenkins系列-Jenkins修改主目录步骤说明

    在使用Jenkins做持续集成过程中,在构建很多次后发现有时在构建的时候系统提示磁盘空间不足,此时检查发现Jenkins的主目录挂载区放在了服务器根目录下,占用空间较大,此时除了对服务器的磁盘进行扩容 ...

  10. tracert的应用

    tracert IP //检查网络各个节点路由情况: 如果是在10个路有点之内访问到了该站点,说明访问速度良好,若是在10~15之间,说明站点访问状况就一般了. ipconfig /flushdns ...