您的位置:首页 > 移动开发 > IOS开发

ios自动布局实现动画

2016-03-06 19:49 323 查看
第一步修改约束的值 , 第二步调用 [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];

}];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: