[英]Using LayoutConstraints just for orientation changes?
當我使用情節提要向按鈕位置等添加約束時,在方向更改時會獲得超平滑的過渡。 按鈕移至其新的相應位置。
但是我使用view.translatesAutoresizingMaskIntoConstraints = true
在屏幕上移動元素。
現在,我幾乎開始為方向更改編寫自定義動畫邏輯。 但是必須有一些更簡單的方法!? 我可以在方向改變之前打開約束,然后再重新抬起約束嗎?
我嘗試使用以下內容將我的商品“粘”在屏幕底部,但沒有用。
NSLayoutConstraint(item: super.bottomLayoutGuide, attribute: .Top, relatedBy: .Equal, toItem: self.centerPositionButton, attribute: NSLayoutAttribute.Bottom, multiplier: 1.0, constant: 20)
我目前正在嘗試很多東西,但是有些事情告訴我,我不能成為第一個嘗試這種東西的人。
NSLayoutConstraint
,使用NSLayoutConstraint
似乎是正確的方法。 謝謝gnasher729指出我在錯誤地使用它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.