Collection View,with custom layouts, cells misbehave on scrolling

后端 未结 2 1939
陌清茗
陌清茗 2021-01-26 21:15

I am trying to create custom tiled layout using UICollectionView. It renders perfectly as desired in simulator once I run my app.

But the moment I scroll the view and br

相关标签:
2条回答
  • 2021-01-26 22:08

    Your layoutAttributesForItemAtIndexPath: method is not setting any properties of the layoutAttributes object before returning it. It needs to set frame (or center and size).

    0 讨论(0)
  • 2021-01-26 22:15

    So finally managed a workaround!!! dequeue each cell with an unique Cell Identifier in cellForRow:

    [self.summaryView registerClass:[BFSSummaryViewCell class] forCellWithReuseIdentifier:[NSString stringWithFormat:@"%@%d",CellIdentifier,indexPath.row]];
    UICollectionViewCell *collectionCell = [collectionView dequeueReusableCellWithReuseIdentifier:[NSString stringWithFormat:@"%@%d",CellIdentifier,indexPath.row] forIndexPath:indexPath];
    

    These two lines inside cellForRow worked for me, however with my collection view having around 1000 cells it increases the size of my application considerably. Lets hope apple fixes this bug asap.

    0 讨论(0)
提交回复
热议问题