深入了解 updateConstraints() 方法的实现

Posted

技术标签:

【中文标题】深入了解 updateConstraints() 方法的实现【英文标题】:Dive into implementation of updateConstraints() method 【发布时间】:2018-03-09 22:41:10 【问题描述】:

有一个问题:我应该在调用<view>.snp.updateConstraints() 方法后调用setNeedsLayout()layoutIfNeeded() 吗?

还是默认实现updateConstraints()就可以了?

提前致谢!

【问题讨论】:

【参考方案1】:

没必要。你可以拨打updateConstraints()

关于 setNeedsLayout()layoutIfNeeded() 你可以在这里阅读:https://medium.com/@abhimuralidharan/ios-swift-setneedslayout-vs-layoutifneeded-vs-layoutsubviews-5a2b486da31c

【讨论】:

以上是关于深入了解 updateConstraints() 方法的实现的主要内容,如果未能解决你的问题,请参考以下文章