Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 992
ZakTaccardi Avatar asked Dec 11 '15 15:12

ZakTaccardi


People also ask

What is the equivalent of RecyclerView in iOS?

TableView and RecyclerView In iOS, TableView is the fundamental UIView that shows a list of items and its cell can be recycled for memory efficiency purpose.

What is recycler Android?

RecyclerView is the ViewGroup that contains the views corresponding to your data. It's a view itself, so you add RecyclerView into your layout the way you would add any other UI element. Each individual element in the list is defined by a view holder object.


3 Answers

Use UICollectionView to achieve this

like image 134
MobileMon Avatar answered Oct 09 '22 07:10

MobileMon


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

RecyclerView  -> UICollectionView Adapter       -> UICollectionViewDataSource ViewHolder    -> UICollectionViewCell LayoutManager -> UICollectionViewLayout 
like image 36
Allan Veloso Avatar answered Oct 09 '22 06:10

Allan Veloso


Several views are currently optimized for performance and resource use, like:

  • UICollectionView
  • UITableView
  • viewControllers
  • UIPageViewController
  • UITabBarController
  • UIStackView

Probably you need the UICollectionView for your proyect.

like image 25
Jorgesys Avatar answered Oct 09 '22 06:10

Jorgesys