ios的AutoresizingMask【转】
在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高。
enum {
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin = 1 << 0,
UIViewAutoresizingFlexibleWidth = 1 << 1,
UIViewAutoresizingFlexibleRightMargin = 1 << 2,
UIViewAutoresizingFlexibleTopMargin = 1 << 3,
UIViewAutoresizingFlexibleHeight = 1 << 4,
UIViewAutoresizingFlexibleBottomMargin = 1 << 5
};
typedef NSUInteger UIViewAutoresizing;
分别解释以上意思。
UIViewAutoresizingNone就是不自动调整。
UIViewAutoresizingFlexibleLeftMargin就是自动调整与superView左边的距离,也就是说,与superView右边的距离不变。
UIViewAutoresizingFlexibleRightMargin就是自动调整与superView的右边距离,也就是说,与superView左边的距离不变。
UIViewAutoresizingFlexibleTopMargin
UIViewAutoresizingFlexibleBottomMargin
UIViewAutoresizingFlexibleWidth
UIViewAutoresizingFlexibleHeight
以上就不多解释了,参照上面的。
也可以多个枚举同时设置。如下:
subView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |UIViewAutoresizingFlexibleRightMargin;
如果有多个,就用“|”关联。
还有一个属性就是autoresizesSubviews,此属性的意思就是,是否可以让其subviews自动进行调整,默认状态是YES,就是允许,如果设置成NO,那么subView的autoresizingMask属性失效。
关于ios的控件的AutoresizingMask属性
setAutoresizingMask控件的自适应
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin = 1 << 0,
UIViewAutoresizingFlexibleWidth = 1 << 1,
UIViewAutoresizingFlexibleRightMargin = 1 << 2,
UIViewAutoresizingFlexibleTopMargin = 1 << 3,
UIViewAutoresizingFlexibleHeight = 1 << 4,
UIViewAutoresizingFlexibleBottomMargin = 1 << 5
UIViewAutoresizingNone
UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(50, 100, 200, 40)];
[label setAutoresizingMask: UIViewAutoresizingNone]; 控件相对于俯视图坐标值不变
ios的AutoresizingMask【转】的更多相关文章
- iOS开发 autoResizingMask使用
autoResizingMask 是UIView的一个属性,在一些简单的布局中,使用autoResizingMask,可以实现子控件相对于父控件的自动布局. autoResizingMask 是UIV ...
- IOS - 控件的AutoresizingMask属性
在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. enum { UIViewAutoresi ...
- iOS开发-自动布局之autoresizingMask使用详解(Storyboard&Code)
前言:现在已经不像以前那样只有一个尺寸,现在最少的IPHONE开发需要最少需要适配三个尺寸.因此以前我们可以使用硬坐标去设定各个控件的位置,但是现在的话已经不可以了,我们需要去做适配,也许你说可以使用 ...
- iOS -- autoResizingMask使用(转)
autoResizingMask 是UIView的一个属性,在一些简单的布局中,使用autoResizingMask,可以实现子控件相对于父控件的自动布局. autoResizingMask 是UIV ...
- ios 中的autoresizingMask
以前对这个知识理解的不太对,看了下面这个地址的文章后,感觉说的对,也没检验,今天实验后,发现是错的...在这里对以前读过此文的朋友表示抱歉. 原文地址如下: http://www.cnblogs.co ...
- iOS开发——View的autoresizingMask属性
View的自适应属性autoresizingMask属性 每一个UIView都有一个autoresizingMask属性,这个属性是用于适应父视图的大小与子视图适应的,源码如下 enum { UIVi ...
- 【iOS 】UIView 中有一个autoresizingMask的属性
在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. 1 2 3 4 5 6 7 8 9 enum ...
- ios开发之--关于UIView的autoresizingMask属性的研究
在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. enum { UIViewAutoresizi ...
- iOS笔记之AutoresizingMask
在 UIView 中有一个autoresizingMask的属性,它对应的是一个枚举的值(如下),属性的意思就是自动调整子控件与父控件中间的位置,宽高. enum { UIViewAutoresi ...
随机推荐
- Http接口获取数据写入Hdfs
数据源类型:数组列表 [{field:value}, {field:value}, {field:value}, {field:value}] 1. 定义http数据源链接 package com.e ...
- strace命令用法详解
Linux利器 strace strace常用来跟踪进程执行时的系统调用和所接收的信号. 在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必 ...
- (笔记)Mysql命令drop database:删除数据库
drop命令用于删除数据库. drop命令格式:drop database <数据库名>; 例如,删除名为 xhkdb的数据库:mysql> drop database xhkdb; ...
- Android 8 AudioPolicy 分析
AudioTrack最终会调用AudioPolicyManager::getOutput(); frameworks\av\services\audiopolicy\managerdefault\Au ...
- e775. 设置JList组件项的维数
By default, the width of the list is determined by the longest item and the height is determined by ...
- e740. 向标签中加入一个图标
This example creates a JLabel component with an icon. // Fetch icon Icon icon = new ImageIcon(" ...
- 查看eclipse版本信息
http://www.cnblogs.com/caiyuanzai/archive/2013/01/11/2855796.html 如果要查询eclipse数字版本号的话,可按如下进行操作: 1. 找 ...
- Java 7中的TransferQueue 以及 SynchronousQueue
Java7中加入了JSR 166y规范对集合类和并发类库的改进.其中的一项是增加了接口TransferQueue和其实现类LinkedTransferQueue. TransferQueue继承了Bl ...
- 激活函数ReLU、Leaky ReLU、PReLU和RReLU
“激活函数”能分成两类——“饱和激活函数”和“非饱和激活函数”. sigmoid和tanh是“饱和激活函数”,而ReLU及其变体则是“非饱和激活函数”.使用“非饱和激活函数”的优势在于两点: 1 ...
- spring 配置 Java配置类装配bean
https://www.cnblogs.com/chenbenbuyi/p/8457700.html 自动化装配的确有很大的便利性,但是却并不能适用在所有的应用场景,比如需要装配的组件类不是由自己的应 ...