ios自动布局实现动画

Posted fantasy3588

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ios自动布局实现动画相关的知识,希望对你有一定的参考价值。

第一步修改约束的值 , 第二步调用  [self.view layoutIfNeeded];

- (IBAction)buttonClick:(UIButton *)sender

{

    self.topViewC.constant += 70;

//    [self.topView setNeedsUpdateConstraints];

    // 调用此方法告诉self.view检测是否需要更新约束,若需要则更新,下面添加动画效果才起作用

//    [self.topView updateConstraintsIfNeeded];

    [UIView animateWithDuration:2.0 animations:^{

          [self.view layoutIfNeeded];

    }];

}

 

以上是关于ios自动布局实现动画的主要内容,如果未能解决你的问题,请参考以下文章