您的位置:首页 > 移动开发 > IOS开发

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.view.top)
(self.view)
------------ > self.view.bottom * 0.25
^
imageView.top

------------ > self.view.bottom * 1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: