Swift--非常好用的适合局部的代码约束

        // 哪个控件的哪个属性等于(大于、小于)另外一个控件的哪个属性乘以多少再加上多少
       eg:    
        let widthContraint = NSLayoutConstraint(item: messageLabel, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1.0, constant: 224)
        addConstraint(widthContraint)

 

posted @ 2016-07-24 18:02  Colaless  阅读(641)  评论(0编辑  收藏  举报