方法一:用三方的框架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 |
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