何时使用UIPageViewController而不是UICollectionViewController?

时间:2017-01-13 17:58:56

标签: ios iphone swift uicollectionview uipageviewcontroller

我想实现一个分页机制来查看像旋转木马或图库的图像,用户只需滑动即可查看下一张图像。

我的要求是图像显示的每个页面都包含来自先前视图控制器的prepare segue语句的传入URL。如果用户想要这些图像可以放大。 在用户返回主视图之前,也不要期望超过10页的页面,并在另一个单元格上选择加载比前一个更新的页面的另一个页面视图控制器。

据我所知,到目前为止,我只能想象以下层次结构

使用页面视图控制器:

Hierarchy: 
- page view controller // controls which page can be seen
-- scroll view controller // allows image to be zoomed in and out
--- image view // image is set through kingfisher and is cached
-- page view controller indicator // indicator of page index

使用集合视图控制器:但不完全确定这是否正确。

Hierarchy: 
- collection view controller // controls which page can be seen
-- collection view cell // container of scroll view with image view 
--- scroll view controller // allows image to be zoomed in and out
---- image view // image is set through kingfisher and is cached
-- page view controller indicator // indicator of page index

但是,当用户滑动时,我遇到了是否在每个单元格中使用page view controllercollection view controller和页面的问题。

看起来似乎页面视图控制器的分页需要在调用时在开始时加载所有必需的内容视图控制器...每次调用滚动手势时都不加载...这是一个页面视图控制器的限制?

我想知道使用这些方法的一些权衡和好处。

谢谢!

0 个答案:

没有答案
相关问题