ios 中autolayout multipli属性的设置

编程入门 行业动态 更新时间:2024-10-13 00:32:44

ios  中autolayout   multipli<a href=https://www.elefans.com/category/jswz/34/1771415.html style=属性的设置"/>

ios 中autolayout multipli属性的设置

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




更多推荐

ios 中autolayout multipli属性的设置

本文发布于:2024-03-23 23:35:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1744171.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   ios   autolayout   multipli

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!