Guest User

Untitled

a guest
Apr 25th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // MARK: - Expanding/Collapsing Logic
  2.  
  3. func expand(in collectionView: UICollectionView) {
  4. initialFrame = self.frame
  5. initialCornerRadius = self.contentView.layer.cornerRadius
  6.  
  7. self.contentView.layer.cornerRadius = 0
  8. self.frame = CGRect(x: 0, y: collectionView.contentOffset.y, width: collectionView.frame.width, height: collectionView.frame.height)
  9.  
  10. layoutIfNeeded()
  11. }
  12.  
  13. func collapse() {
  14. self.contentView.layer.cornerRadius = initialCornerRadius ?? self.contentView.layer.cornerRadius
  15. self.frame = initialFrame ?? self.frame
  16.  
  17. initialFrame = nil
  18. initialCornerRadius = nil
  19.  
  20. layoutIfNeeded()
  21. }
Add Comment
Please, Sign In to add comment