UICollectionView setLayout:animated: not preserving zIndex

前端 未结 7 1980
既然无缘
既然无缘 2021-02-01 20:12

I\'ve noticed that when calling setLayout:animated in a UICollectionView to switch between two layouts, the currently visible cell doesn\'t adhere to t

7条回答
  •  日久生厌
    2021-02-01 20:46

    I have had the same problem. Switching the layout will disregard the zIndex for the cell.

    I have managed to make it "look right" by applying a translation on the z-axis like this:

    attributes.transform3D = CATransform3DMakeTranslation(0, 0, indexPath.row);
    

    But it is just a visual fix, if you try to click on the item you will realize that the zIndex is still wrong until it is recycled by scrolling it offscreen.

提交回复
热议问题