在我的程序中我有14個不同的按鈕,每個都有一個字母。每個按鈕都通過自動佈局相互連接。所以有很多的限制。見第一圖像解釋:自動佈局和動畫
但我希望能夠通過UIAnimation
移動每一個按鍵來回不搞亂整個汽車佈局設置。見第二圖像解釋,我想做的事:
現在的代碼我目前使用得到這些動畫:
self.letterA.translatesAutoresizingMaskIntoConstraints = YES;
[UIView animateWithDuration:0.2 animations:^{
[letterA setFrame:CGRectMake(x, y, width, height)];
}];
現在程序完美的作品!絕對沒有問題!但唯一的「問題」是這樣的代碼在控制檯中生成此消息:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
而且此警告/錯誤/問題的推移和和好幾次,每一次一個UIButton
移動。現在我該怎麼辦?
- 我可以忽略
Unable to simultaneously satisfy constraints
嗎?或者會在路上造成麻煩? - 如果不是,如何解決它?而且由於涉及到大量的約束條件,如何在不編輯每一個約束的情況下修復?
- 我非常想繼續使用動畫
setFrame: