我想在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