tongyuling

在更新约束时,要调用:

// 告诉self.view约束需要更新

  [self.view setNeedsUpdateConstraints];

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

  [self.view updateConstraintsIfNeeded];

  

  [UIView animateWithDuration:0.3 animations:^{

    [self.view layoutIfNeeded];

  }];

 

//苹果推荐在updateViewConstraints方法中更新或者添加约束的

- (void)updateViewConstraints {

  [super updateViewConstraints];

}

分类:

技术点:

相关文章:

  • 2021-12-16
  • 2021-12-16
  • 2021-10-02
  • 2021-10-29
  • 2021-04-23
  • 2021-09-30
  • 2021-10-04
  • 2021-09-27
猜你喜欢
  • 2022-01-21
  • 2021-12-04
  • 2021-10-14
  • 2021-05-06
  • 2021-08-02
  • 2021-09-30
  • 2022-01-03
相关资源
相似解决方案