Should we use UITableView when we have UICollectio

2019-05-23 05:55发布

问题:

I have worked with both UICollectionView and UITableView and its trivial to make UICollectionView look like table. What is more usage patterns are very similar, you don't have to learn a lot of new stuff to use it.

The question is are there any arguments for using UITableView and not UICollectionView? Or we can just switch to UICollectionView and forget about UITableView?

回答1:

I don't think so.

For example, if you want to have some stickies header, you've got to create a custom Layout for your UICollectionView, whereas, it's really easy with UITableView.

Moreover you have plain and grouptableViews, which is really usefull.

In my own opinion, I would say sometimes it's better to mutualize and use a collectionView (if it's a tableview on iPhone and a collectionView on iPad for instance), but not everytime.