ios 中autolayout multipli属性的设置
2016-05-06 11:09
344 查看
方法一:用三方的框架masonry
[self.loginBtnmas_makeConstraints:^(MASConstraintMaker
*make) {
make.width.equalTo(self.view.mas_width).multipliedBy(0.3);
make.height.equalTo(@30);
make.centerX.equalTo(self.view.mas_centerX);
make.top.equalTo(self.view.mas_bottom).multipliedBy(0.7);
}];
设置一个button在view的0.7处,,
不能写成:
make.top.equalTo(self.view.mas_height).multipliedBy(0.7);
会报错 。。
方法二:
如果用storyboard可以这样:
1.把imageview的顶部拖到与superview的bottom齐平。
2.改变Align Center Y的Mutiplier,1改为4,即为superview的1/4处。
引用他人的一个说法
你可以这样理解,imageView.top = self.view.bottom*1 就是:
|
self.view.bottom |
v |
------------------(1)
^ |
imageView.top |
imageView.top = self.view.bottom*0.25,就是在上面的基础上乘以0.25,就是:
[self.loginBtnmas_makeConstraints:^(MASConstraintMaker
*make) {
make.width.equalTo(self.view.mas_width).multipliedBy(0.3);
make.height.equalTo(@30);
make.centerX.equalTo(self.view.mas_centerX);
make.top.equalTo(self.view.mas_bottom).multipliedBy(0.7);
}];
设置一个button在view的0.7处,,
不能写成:
make.top.equalTo(self.view.mas_height).multipliedBy(0.7);
会报错 。。
方法二:
如果用storyboard可以这样:
1.把imageview的顶部拖到与superview的bottom齐平。
2.改变Align Center Y的Mutiplier,1改为4,即为superview的1/4处。
引用他人的一个说法
你可以这样理解,imageView.top = self.view.bottom*1 就是:
|
self.view.bottom |
v |
------------------(1)
^ |
imageView.top |
imageView.top = self.view.bottom*0.25,就是在上面的基础上乘以0.25,就是:
------------ > (self.view.top) (self.view) ------------ > self.view.bottom * 0.25 ^ imageView.top ------------ > self.view.bottom * 1
相关文章推荐
- iOS应用兼容IPv6
- iOS开发_从一个带有空格和特殊符号的字符串里提取数字即手机号的方法
- iOS开发-请求网页的两种方式
- iOS之修改项目BUG之旅--(四)
- iOS9 新特性总结
- iOS OC 成员变量是强引用还是弱引用
- iOS 多线程(4)NSOperation
- ios 安全相关工具整理
- iOS WebRTC
- iOS之修改项目BUG之旅--(三)
- iOS私有API的了解
- ios字体动态下载
- IOS开发-自动布局Autoresizing和Autolayout
- ios自定义AlertView
- iOS: 属性声明strong和retain竟然不一样
- 通知机制(NSNotification)
- iOS--- 文件路径保存
- iOS多线程(3)GCD
- iOS - 功能模块 - 发布时间
- iOS 键盘遮挡