Reorder cells of UICollectionView

前端 未结 4 1315
半阙折子戏
半阙折子戏 2020-12-12 19:07

Consider a UICollectionView with flow layout and horizontal direction. By default, cells are ordered from top to bottom, left to right. Like this:



        
4条回答
  •  我在风中等你
    2020-12-12 20:00

    You have an object that implements the UICollectionViewDataSource protocol. Inside collectionView:cellForItemAtIndexPath: simply return the correct item that you want to return. I don't understand where there would be a problem.

    Edit: ok, I see the problem. Here is the solution: http://www.skeuo.com/uicollectionview-custom-layout-tutorial , specifically steps 17 to 25. It's not a huge amount of work, and can be reused very easily.

提交回复
热议问题