title: How to change UICollectionView height on button click
body: <p>I’m trying to change height of a collectionview and a view when I click a button. But when I click the button the height of the view changes but not the height of the collectionview.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>@IBAction func button(_ sender: Any) {
          UIView.animate(withDuration: 1, animations: {
              self.backView.frame.size.height -= 160
              self.collectionView.frame.size.height -= 160
              UIView.animate(withDuration: 0.3, delay: 0, options:     .curveEaseOut,
                                         animations:     self.view.layoutIfNeeded, completion: nil)
  
          }, completion: nil)
      }
  </code></pre>
  
  <p>What can I do to also resize the collectionview?</p>