Yalantis / DisplaySwitcher

Custom transition between two collection view layouts
https://yalantis.com
MIT License
2.32k stars 190 forks source link

Custom contentInset breaks the layout #37

Open Drusy opened 6 years ago

Drusy commented 6 years ago

Report

Settings a custom contentInset on the collection view breaks the layout after changing the layout several times

Report a bug

What did you do?

Update the example code with the following:

    @IBOutlet fileprivate weak var collectionView: UICollectionView! {
        didSet {
            collectionView.contentInset = UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 4)
        }
    }

What did you expect to happen?

Set the custom contentInset on the collection view and display cells normally

What happened instead?

The custom contentInset seems to be used but the layout is broken, there is a huge empty space before the first cell appear and the layout animation flickers.

Your Environment

Project that demonstrates the bug

Simply updating your example project with the code previously provided on the UICollectionView outlet.