2016-08-09 24 views

cevap

25

addConstraint yerine, kullanın. constraintsWithVisualFormat bir dizi döndürür.

Kodunuz haline gelir:

addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[v0]|", options: [], metrics: nil, views: ["v0": userProfileImageView]) 
2
let horizontalprofileViewConstraint = NSLayoutConstraint.constraintsWithVisualFormat("H:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": userProfileImageView] 

Zaten bir dizidir [NSLayoutConstraint] olarak türünü göreceksiniz horizontalprofileViewConstraint üzerinde seçeneğini tıklayın ve gelirsek.

Peki ne yapabilirsiniz geçerli:

view.addConstraints(horizontalprofileViewConstraint) 

sonra yapmanız cand birden fazla görünüm varsa:

view.addConstraints(horizontalprofileViewConstraint + verticalprofileViewConstraint) 

+ sizin için diziler için katılır.

İlgili konular