When to use UICollectionView instead of UITableView?

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

    For simple lists and forwards/backwards navigtaion, use UITableView.

    If you need a high degree of customisability, use UICollectionView.

    Generally speaking, in software development, it's best to choose the approach which represents "The Simplest Possible Thing".

    EDIT: As of iOS 14, UICollectionView can now do lists as well and is now the recommended approach. See this session from WWDC20 for more information and implementation details: https://developer.apple.com/videos/play/wwdc2020/10026/

提交回复
热议问题