iOS 关于UIViewAutoresizing autoresizingMask的记录
2016-05-27 16:48
423 查看
官方简介:
// simple resize. default is UIViewAutoresizingNone
An integer bit mask that determines how the receiver resizes itself when its superview’s bounds change.
ps:当父视图的bounds改变的时候,根据枚举的integer的类型自动调整位子
typedefNS_OPTIONS(NSUInteger, UIViewAutoresizing) {
UIViewAutoresizingNone =0, //!< 不进行自动调整
UIViewAutoresizingFlexibleLeftMargin =1 <<0,//!< 自动调整与superView的左边距离,保证右边距离不变
UIViewAutoresizingFlexibleWidth =1 <<1,//!< 自动调整自己的宽度,保证与superView左边和右边的距离不变
UIViewAutoresizingFlexibleRightMargin =1 <<2,//!< 与UIViewAutoresizingFlexibleLeftMargin相反
UIViewAutoresizingFlexibleTopMargin = 1 <<3,//!< 自动调整与superView顶部的距离,保证与bottom不变
UIViewAutoresizingFlexibleHeight =1 <<4,//!< 自动调整自己的高度,保证与superView顶部与底部不变
UIViewAutoresizingFlexibleBottomMargin =1 <<5 //!< 与UIViewAutoresizingFlexibleTopMargin相反
};
UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight 自动调整自己的宽度,保证现在宽高和之前的宽高比例不变。比如原来距离为20,40,调整后的距离应为75,,即75/20=150/40。
其它的组合类似。
简单概括就是出现哪个单词,就是哪个方向根据superView进行调整
举个栗子
1.UIViewAutoresizingNone
2.左下角不变,高度自由生长
注意用 | 隔开(左边不变就用UIViewAutoresizingFlexibleRightMargin)
view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin
| UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight
还有个属性是 autoresizesSubviews
default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes
默认是Yes,子视图根据autoresizingMask的值进行自动调整,如果设置成NO,那么autoresizingMask直接无效
// simple resize. default is UIViewAutoresizingNone
An integer bit mask that determines how the receiver resizes itself when its superview’s bounds change.
ps:当父视图的bounds改变的时候,根据枚举的integer的类型自动调整位子
typedefNS_OPTIONS(NSUInteger, UIViewAutoresizing) {
UIViewAutoresizingNone =0, //!< 不进行自动调整
UIViewAutoresizingFlexibleLeftMargin =1 <<0,//!< 自动调整与superView的左边距离,保证右边距离不变
UIViewAutoresizingFlexibleWidth =1 <<1,//!< 自动调整自己的宽度,保证与superView左边和右边的距离不变
UIViewAutoresizingFlexibleRightMargin =1 <<2,//!< 与UIViewAutoresizingFlexibleLeftMargin相反
UIViewAutoresizingFlexibleTopMargin = 1 <<3,//!< 自动调整与superView顶部的距离,保证与bottom不变
UIViewAutoresizingFlexibleHeight =1 <<4,//!< 自动调整自己的高度,保证与superView顶部与底部不变
UIViewAutoresizingFlexibleBottomMargin =1 <<5 //!< 与UIViewAutoresizingFlexibleTopMargin相反
};
UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight 自动调整自己的宽度,保证现在宽高和之前的宽高比例不变。比如原来距离为20,40,调整后的距离应为75,,即75/20=150/40。
其它的组合类似。
简单概括就是出现哪个单词,就是哪个方向根据superView进行调整
举个栗子
1.UIViewAutoresizingNone
2.左下角不变,高度自由生长
注意用 | 隔开(左边不变就用UIViewAutoresizingFlexibleRightMargin)
view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin
| UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight
还有个属性是 autoresizesSubviews
default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes
默认是Yes,子视图根据autoresizingMask的值进行自动调整,如果设置成NO,那么autoresizingMask直接无效
相关文章推荐
- 【Moqui业务逻辑翻译系列】--UBPL index
- 【Moqui业务逻辑翻译系列】--UBPL Introduction同意的商业处理文库介绍
- sap openui5 mobile (UI5 Runtime Mobile)下载
- UE4如何解析命令行参数
- esayui datagrid 动态列
- MUI多端发布开发指南(终于把MUI的使用场景说清楚了)
- PriorityQueue
- 动态树形菜单的实现
- easyUI构造满足tree要求的json
- 动态改变easyUI的datagrid的columns
- js模块化require.js真的蛮有用
- easyui queryParams的使用
- Duilib中系统消息在自己窗口类的使用
- UIWindow
- 【iOS】CoreBluetooth1 初识
- UITableViewCell显示混乱问题
- 分段控制器--UISegmentedControl 基本用法
- StringBuffer与StringBuilder之间区别
- 1051. Pop Sequence (25)
- @RequestParam @RequestBody @PathVariable 等参数绑定注解详解