When to use UICollectionView instead of UITableView?

前端 未结 15 1600
闹比i
闹比i 2020-12-07 12:57

I found that UICollectionView is like an upgraded version of UITableView introduced in iOS6, but when should I choose UICollectionView

相关标签:
15条回答
  • 2020-12-07 13:50

    Its totally dependent on how your data to be shown. As mentioned by many above, if you require only single set of data and that too not complex, go for UITableView else use UICollectionView.

    UICollectionView is customization friendly.

    If you are dealing with multiple cell heights or so, then go for UICollectionView.

    0 讨论(0)
  • 2020-12-07 13:50

    Both are depends on the requirements. Table Views also have support for a variety of editing scenarios. This support has not been implemented in the Collection View classes. If you are converting from a Table View that relies on these methods, expect to do a little extra heavy lifting in the Collection View. Collection View section headers can be placed anywhere within the view. and UITableView don't need to set buttons with tags or other things by getting selected items values.

    0 讨论(0)
  • 2020-12-07 13:54

    Although it's not required, I always use a collectionview. That way I can easily adapt how my collections are presented for differing resolutions. A plus is that it's ready to quickly add new types of cells when refactoring in the future.

    I see no point of tableviews. It's very simple to use a collection view to represent a table. IMO.

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