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 (ie tablet).
Does iOS have a similar layout API like RecyclerView
to allow something this flexible? If so - what is it?
使用 UICollectionView 来实现这一点
Yes, not just similar pattern but it also reuse the views:
RecyclerView -> UICollectionView
Adapter -> UICollectionViewDataSource
ViewHolder -> UICollectionViewCell
LayoutManager -> UICollectionViewLayout
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.