Reputation: 12477
I have a RecyclerView
(with a GridLayoutManager
) that has 4 different view types. In a phone portrait layout, every view type should display 1 item per row. However, one view type (a card) can display two cards per row if the device width is large enough (i.e. tablet).
Does iOS have a similar layout API like RecyclerView
to allow something this flexible? If so - what is it?
Example (more columns in tablet vs phone)
Upvotes: 27
Views: 28435
Reputation: 126543
Several views are currently optimized for performance and resource use, like:
UICollectionView
UITableView
viewControllers
UIPageViewController
UITabBarController
UIStackView
You need the UICollectionView
that is similar to a Android´s RecyclerView
.
Upvotes: 4
Reputation: 34341
When you want to use reusable pattern for showing scrollable multi items on screen usually you can use UITableView
, UICollectionView
If you need some custom layout you should take a look into UICollectionView
Upvotes: 1
Reputation: 6389
Yes, not just similar pattern but it also reuse the views:
RecyclerView -> UICollectionView
Adapter -> UICollectionViewDataSource
ViewHolder -> UICollectionViewCell
LayoutManager -> UICollectionViewLayout
Upvotes: 18