ZakTaccardi
ZakTaccardi

Reputation: 12477

Does iOS have something similar to Android's RecyclerView?

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) Example of what I'm trying to achieve.

Upvotes: 27

Views: 28435

Answers (4)

Jorgesys
Jorgesys

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

yoAlex5
yoAlex5

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

Allan Veloso
Allan Veloso

Reputation: 6389

Yes, not just similar pattern but it also reuse the views:

RecyclerView  -> UICollectionView
Adapter       -> UICollectionViewDataSource
ViewHolder    -> UICollectionViewCell
LayoutManager -> UICollectionViewLayout

Upvotes: 18

MobileMon
MobileMon

Reputation: 8661

Use UICollectionView to achieve this

Upvotes: 22

Related Questions