我想在MAGNIFY圖標IOS設置約束的動畫圖標
執行下列約束動畫在我希望我的圖標是在我的屏幕的右邊,然後將其移動到左邊開始我文本框:
___________________
|___________________| O-
to
___________________
O- |___________________|
所以我所做的就是建立在優先級爲1000 的圖標,我的上海華權約束的,在優先級上的圖標添加其他約束B,我的文本框的左側750
然後當我想要perfo RM我的動畫我刪除約束A,所以我希望圖標移動到我的texfield的左側,但它沒有移動
如何做到這一點?
約束答:
約束B:
[UIView animateWithDuration:0.5 animations:^{
self.view.alpha = 1;
} completion:^(BOOL finished) {
//animating the icon
[self.view removeConstraint:_loupeSuperviewLeftMargin];//remove constraint A
[self.view setNeedsUpdateConstraints];
UIView animateWithDuration:0.5f animations:^{
[self.view invalidateIntrinsicContentSize];
[self.view layoutIfNeeded];
}];
}];
嘗試在視圖上調用invalidateIntrinsicContentSize以使其重新計算約束。 – Gismay 2014-10-29 15:51:53
您是否需要將文本字段向右移動以爲圖標在其新位置騰出空間?你對文本字段有什麼限制? – rdelmar 2014-10-29 16:17:46
texfield位於我的超級視圖中,我希望圖標在其左側滑動。調用invalidateIntrinsicContentSize什麼也沒做 – Mathieu 2014-10-29 16:19:41