chiahsien/CHTCollectionViewWaterfallLayout

Wrong layout

alexanderkhitev opened this issue · 0 comments

Hello! As a thank you for the wonderful framework. I ran into the following problem. I always have to have the left cell bigger, the right one smaller. Behavior works well for the first cells, in the middle already there is a strange behavior, and at the end the layout "breaks". Tell me how can I fix this?

  fileprivate lazy var layout: CHTCollectionViewWaterfallLayout = {
        let layout = CHTCollectionViewWaterfallLayout()
        layout.itemRenderDirection = .chtCollectionViewWaterfallLayoutItemRenderDirectionLeftToRight
        layout.sectionInset = UIEdgeInsets(top: 0, left: 12, bottom: 12, right: 12)
        return layout
    }()
    
    fileprivate lazy var collectionView: UICollectionView = {
        let collection = UICollectionView(frame: .zero, collectionViewLayout: self.layout)
        collection.translatesAutoresizingMaskIntoConstraints = false
        collection.backgroundColor = .white
        return collection
    }()

1
2
3
4
5