Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MARK: - Expanding/Collapsing Logic
- func expand(in collectionView: UICollectionView) {
- initialFrame = self.frame
- initialCornerRadius = self.contentView.layer.cornerRadius
- self.contentView.layer.cornerRadius = 0
- self.frame = CGRect(x: 0, y: collectionView.contentOffset.y, width: collectionView.frame.width, height: collectionView.frame.height)
- layoutIfNeeded()
- }
- func collapse() {
- self.contentView.layer.cornerRadius = initialCornerRadius ?? self.contentView.layer.cornerRadius
- self.frame = initialFrame ?? self.frame
- initialFrame = nil
- initialCornerRadius = nil
- layoutIfNeeded()
- }
Add Comment
Please, Sign In to add comment