Crash on ADMozaikLayoutSectionMatrixError.rowOutOfBounds
rajatkj opened this issue · 4 comments
`fileprivate var mosaicLayout: ADMozaikLayout {
let layout = ADMozaikLayout(delegate: self)
return layout
}
func setupCollection() {
self.collection.collectionViewLayout.invalidateLayout()
self.collection.setCollectionViewLayout(self.mosaicLayout, animated: true)
collection.delegate = self
collection.dataSource = self
collection.reloadData()
}
extension PostGridCell: ADMozaikLayoutDelegate {
func collectionView(_ collectionView: UICollectionView, mozaik layout: ADMozaikLayout, mozaikSizeForItemAt indexPath: IndexPath) -> ADMozaikLayoutSize {
if indexPath.item == 0 {
return ADMozaikLayoutSize(numberOfColumns: 1, numberOfRows: 1)
}
if indexPath.item % 8 == 0 {
return ADMozaikLayoutSize(numberOfColumns: 2, numberOfRows: 2)
}
else if indexPath.item % 6 == 0 {
return ADMozaikLayoutSize(numberOfColumns: 3, numberOfRows: 1)
}
else if indexPath.item % 4 == 0 {
return ADMozaikLayoutSize(numberOfColumns: 1, numberOfRows: 3)
}
else {
return ADMozaikLayoutSize(numberOfColumns: 1, numberOfRows: 1)
}
}
func collectonView(_ collectionView: UICollectionView, mozaik layoyt: ADMozaikLayout, geometryInfoFor section: ADMozaikLayoutSection) -> ADMozaikLayoutSectionGeometryInfo {
let width = UIScreen.main.bounds.width/5
let rowHeight: CGFloat = width//layoutType == .portrait ? 93 : 110
let columns = [ADMozaikLayoutColumn(width: width), ADMozaikLayoutColumn(width: width), ADMozaikLayoutColumn(width: width), ADMozaikLayoutColumn(width: width)]
let geometryInfo = ADMozaikLayoutSectionGeometryInfo(rowHeight: rowHeight, columns: columns, minimumInteritemSpacing: 5,minimumLineSpacing: 5,sectionInset: UIEdgeInsets(top: 5, left: 0, bottom: 5, right: 0),headerHeight: 0, footerHeight: 0)
return geometryInfo
}
}
extension PostGridCell : UICollectionViewDataSource,UICollectionViewDelegate{
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 100
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PostCell.reuseIdentifier, for: indexPath)
cell.backgroundColor = .red
return cell
}
}
`
This is how i configured the collectionview the library crashes on Crash on ADMozaikLayoutSectionMatrixError.rowOutOfBounds
Hi @Rico9260 thanks for reporting it, I will check it soon.
Hi, @Rico9260 could you report please what device or simulator did you use to get a crash? So far I can not reproduce the crash. Do you have any other information that may help?
I have tried all Devices and Simulators. I have configured CollectionView inside a Tableviewcell.
@Rico9260 are you able to provide a sample project that crashes?