1. 程式人生 > >iOS UI(佈局)約束是什麼?view1.attr1 = view2.attr2 * multiplier + constant

iOS UI(佈局)約束是什麼?view1.attr1 = view2.attr2 * multiplier + constant

/* Create constraints explicitly.  Constraints are of the form "view1.attr1 = view2.attr2 * multiplier + constant" 

 If your equation does not have a second view and attribute, use nil and NSLayoutAttributeNotAnAttribute.

 */

自動佈局核心公式

view1.attr1 = view2.attr2*multiplier+constant

自動佈局建構函式

 NSLayoutConstraint( item: 檢視,
                      attribute: 約束屬性,
                      relatedBy: 約束關係,
                      toItem: 參照檢視,
                      attribute: 參照屬性,
                      multiplier: 乘積,
                      constant: 約束數值)


所有衍生的佈局工具都以此為基礎