When to use UICollectionView instead of UITableView?

前端 未结 15 1629
闹比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:44

    Based on our requirement we choose UITableView or UICollection view.

    If we want to display images or items in grid type or if we need more customisability we use UICollectionview.

    For listing each item with details and subdetails we use UITableView.

    UICollectionView: The UICollectionView class manages an ordered collection of data items and presents them using customizable layouts. Collection views provide the same general function as table views except that a collection view is able to support more than just single-column layouts.

    UITableView: A table view displays a list of items in a single column. UITableView is a subclass of UIScrollView, which allows users to scroll through the table, although UITableView allows vertical scrolling only.

提交回复
热议问题