Yalantis / DisplaySwitcher

Custom transition between two collection view layouts

Home Page:https://yalantis.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom contentInset breaks the layout

Drusy opened this issue · comments

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

  • Version of the component: a02d5a1
  • Swift version: 4.1
  • iOS version: 11.2.6
  • Device: Simulator iPhone X / iPhone 6Plus
  • Xcode version: 9.3
  • If you use Carthage: 0.29.0

Project that demonstrates the bug

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