[英]How to use AutoLayout programmatically with subviews inside a UITextView as the text position changes dynamically when the UITextView resizes
對於每個要對齊的對象,您都必須像上面的示例一樣編寫一些代碼:
@IBOutlet weak var messageTextView: UITextView!
var newConstraint = NSLayoutConstraint.constraintsWithVisualFormat("H:[messageTextView]", options: NSLayoutFormatOptions.AlignAllCenterX metrics: nil, views: ["messageTextView": messageTextView])
messageTextView.addConstraints(newConstraint)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.