How to know UIStackView finish auto layout

I set a subview of UIStackView hidden as YES, and the subview will auto layout, where can I know it has been already layout

Replies

Why do you need to know ?

viewWillLayout and viewDidLayout are asynchnous, so you cannot tell.


But if you need to cause immediate layout of the subview (sync layout), call

theSubView.layoutIfNeeded()

It will be executed immediately (even if subview is hidden)


You may read this for detailed explanations

h ttps://medium.com/@abhimuralidharan/ios-swift-setneedslayout-vs-layoutifneeded-vs-layoutsubviews-5a2b486da31c

Did you solve your issue ?