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