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

在 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就是不自动调整。
UIViewAutoresizingFlexibleLeftMargin 自动调整与superView左边的距离,保证与superView右边的距离不变。
UIViewAutoresizingFlexibleRightMargin 自动调整与superView的右边距离,保证与superView左边的距离不变。
UIViewAutoresizingFlexibleTopMargin 自动调整与superView顶部的距离,保证与superView底部的距离不变。
UIViewAutoresizingFlexibleBottomMargin 自动调整与superView底部的距离,也就是说,与superView顶部的距离不变。
UIViewAutoresizingFlexibleWidth 自动调整自己的宽度,保证与superView左边和右边的距离不变。
UIViewAutoresizingFlexibleHeight 自动调整自己的高度,保证与superView顶部和底部的距离不变。
UIViewAutoresizingFlexibleLeftMargin  |UIViewAutoresizingFlexibleRightMargin 自动调整与superView左边的距离,保证与左边的距离和右边的距离和原来距左边和右边的距离的比例不变。比如原来距离为20,30,调整后的距离应为68,102,即68/20=102/30。

其它的组合类似。

原文:http://www.cnblogs.com/jiangyazhou/archive/2012/06/26/2563041.html

时间: 2024-08-11 23:08:27

转-关于UIView的autoresizingMask属性的研究的相关文章

关于UIView的autoresizingMask属性的研究

在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. UIViewAutoresizingNone就是不自动调整.UIViewAutoresizingFlexibleLeftMargin 自动调整与superView左边的距离,保证与superView右边的距离不变.UIViewAutoresizingFlexibleRightMargin 自动调整与superView的右边距离,保证与super

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

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

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

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

UIView的autoresizingMask属性的使用

在iOS应用的开发过程中,经常会使用,setFrame的方式对UIView进行布局, 经常会使用计算的方式,如self.view.bounds.size.height - 20-44- Heignt等来计算Y的相对位置 我们知道上边的数字 20是status bar的高度,44是navigationBar的高度. 这样的写法没有什么错误,但是不利于代码的复用,比如一个ViewController在创建的时候,有可能有navigationController,也可能没有navigationCont

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

UIView的autoresizingMask属性,是用在当一个UIView实例的父控件的尺寸发生变化时,来自动调整UIView实例在父控件中的位置与尺寸的.autoresizingMask属性是一个枚举值,它的枚举成员如下: 它通过使UIView的上.下.左.右.宽度或高度自动变化来调整.下面分几种情况来讨论这个属性,假设父控件为backgroundView,子控件为subView: 1.当没有使用autoresizingMask属性或autoresizingMask属性的值为UIViewAu

UIView的autoresizingMask属性

今天做相册列表的时候,发现有些 UITableViewController 属性不好记忆,然后就查找了一些资料.做一下备份. 在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. enum { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleW

iOS8 UIView之autoresizingMask 的使用

UIView的autoresizingMask属性 是用来适应父视图的变化(根据父视图的变化进而调整自身Frame属性). @property(nonatomic) BOOL autoresizesSubviews; // default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes @property(nonatomic) UIViewAutore

UIView的autoresizingMask和autoresizesSubviews属性的剖析

UIVIew的autoresizingMask和autoresizesSubviews属性的剖析 和frame.bounds.center.transform等属性一样,autoresizingMask和autoresizesSubviews也是属于UIView的几何分类-UIViewGeometry中的属性. @property(nonatomic) BOOL autoresizesSubviews; // default is YES. if set, subviews are adjust

UIView控件属性

UIView控件属性: 1.alpha 设置视图的透明度.默认为1. // 完全透明 view.alpha = 0; // 不透明 view.alpha = 1; 2.clipsToBounds // 默认是NO,当设置为yes时,超出当前视图的尺寸的内容和子视图不会显示. view.clipsToBounds = YES; 3.hidden // 默认是NO,当设置为yes,视图就看不见了. view.hidden = YES; 4.userInteractionEnabled // 默认为Y