Search code examples
iosuitableviewios6datagriduicollectionview

UITableView or Collection View?


I have an iPad app which always stays in landscape mode. It is more of a data centered app with 5 columns and couple of hundreds of rows.

In current implementation, I have used UITableView. The rows' height could be anything depending on the data that comes in from server and all the columns can have different size.

The question is, can I use UICollectionView instead of UITableView? Will there be any performance issues? If yes, which is better in grid like layout? I understand UICollectionView is to be used in iOS pictures app like layout but how it behaves for grid like layout?

Thanks, Pruthvid


Solution

  • What you describe is exactly what UICollectionView is designed for, it's the perfect solution. The limitation is only to the version of iOS you will be able to support (if you need to go back that far).

    The choice really comes down to the visuals you want. Of you want each row to have a height defined by the maximum height of any column value in that row and the row appears as a single row item and the last row of the table should be full width then you may prefer to use a table view.

    The collection view gives you more options for accessory views (as opposed to just the headers and footers of the table view).