使用UIViewAnimationOptionBeginFromCurrentState选项设置NSAutolayoutConstraint动画
从堆栈示例中,我了解了如何设置命名约束的常量参数的动画。它工作得很好,但我遇到了一个我还没有找到解决方案的问题。我为动画设置了UIViewAnimationOptionBeginFromCurrentState选项,并希望能够通过iAction方法切换动画最终状态,即使在动画期间也是如此。代码如下:使用UIViewAnimationOptionBeginFromCurrentState选项设置NSAutolayoutConstraint动画,animation,ios7,nslayoutconstraint,autolayout,Animation,Ios7,Nslayoutconstraint,Autolayout,从堆栈示例中,我了解了如何设置命名约束的常量参数的动画。它工作得很好,但我遇到了一个我还没有找到解决方案的问题。我为动画设置了UIViewAnimationOptionBeginFromCurrentState选项,并希望能够通过iAction方法切换动画最终状态,即使在动画期间也是如此。代码如下: - (IBAction)animate:(id)sender { self.brownViewHeightConstraint.constant = self.expanded ? 100.
- (IBAction)animate:(id)sender {
self.brownViewHeightConstraint.constant = self.expanded ? 100.f : 390.f;
[self.brownView setNeedsUpdateConstraints];
self.expanded = !self.expanded;
[UIView animateWithDuration: 1.0
delay: 0
options: UIViewAnimationOptionBeginFromCurrentState
animations: ^{
[self.brownView layoutIfNeeded];
}
completion:^(BOOL finished) {
}
];
}
动画不支持UIViewAnimationOptionBeginFromCurrentState选项。如何使用AutoLayout实现此行为?这是非常简单,还是没有人真正知道答案?无论哪种方式,我都希望踢向正确的方向。。。