关于更新约束
作者:
Demonboy | 来源:发表于
2017-07-04 10:26 被阅读11次- (void)viewDidLoad {
[superviewDidLoad];
//在更新约束时,要调用:
//告诉self.view约束需要更新使用这个方法会走- (void)updateViewConstraints这个方法
[self.view setNeedsUpdateConstraints];
//调用此方法告诉self.view检查是否需要更新约束若需要则更新下面添加动画效果才起作用
[self.view updateConstraintsIfNeeded];
[UIView animateWithDuration:0.25 animations:^{
[self.view layoutIfNeeded];
}];
}
//苹果推荐在updateViewConstraints方法中更新或者添加约束
- (void)updateViewConstraints
{
[super updateViewConstraints];
}
本文标题:关于更新约束
本文链接:https://www.haomeiwen.com/subject/immthxtx.html
网友评论