iOS 关于布局问题的一些认识

///更新约束和布局

更新约束布局相关的API

- (void)updateConstraintsIfNeeded  调用此方法,如果有标记为需要重新布局的约束,则立即进行重新布局,内部会调用updateConstraints方法

- (void)updateConstraints          重写此方法,内部实现自定义布局过程

- (BOOL)needsUpdateConstraints     当前是否需要重新布局,内部会判断当前有没有被标记的约束

- (void)setNeedsUpdateConstraints  标记需要进行重新布局

 

UIView重新布局相关的API

- (void)setNeedsLayout  标记为需要重新布局

- (void)layoutIfNeeded  查看当前视图是否被标记需要重新布局,有则在内部调用layoutSubviews方法进行重新布局

- (void)layoutSubviews  重写当前方法,在内部完成重新布局操作

posted @ 2018-12-04 17:40  tryFighting  阅读(205)  评论(0编辑  收藏  举报