I have code under viewDidLayoutSubviews
with intention of making an image transparent (alpha = 0) in the beginning which slowly fades in (into alpha = 1) with code under viewDidAppear
. Also, I have a button which changes it's own label text when pressed.
However, when the button is pressed and the label changes, the image (which I've specified under viewDidLayoutSubviews
) also disappears. Which I think is because the code under viewDidLayoutSubviews
has been called?
My question is:
1) What is the meaning of viewDidLayoutSubviews
? Why is it called when the button label changes? Just briefly/generally, what is setNeedsLayout
& setNeedsDisplayInRect
?
2) Is it better to use viewWillAppear then?
Here are 2 similar questions but I couldn't understand enough from them:
1) viewDidLayoutSubviews is called when label changes (xcode) (swift)