ios - 如何将集合视图和页面视图放在一个场景中
问题描述
我正在创建一个如下所示的屏幕:
但问题是,pagedView 需要我的视图控制器继承自UIPagedViewController
,而 colleciton 视图需要继承自UICollectionViewController
.
有没有办法做到这一点?
解决方案
您不必使用UIPagedViewController
或UICollectionViewController
使其继承自UIViewController
,并且在里面说loadView/ViewDidLoad
使用
let pager = UIPagedViewController()
// then add it as a child vc and constraint it's view or set a frame
和
let collec = UICollectionView(///
// add to view and constraint also
以上也应该是实例变量,因此它们的代表/数据源被保留
推荐阅读
- laravel - 由于 php 版本不同,magento 2 和 laravel 不支持
- selenium-webdriver - ContextClick 选项在 Selenium 3.0 中不起作用
- python - 如何在 Python 中创建深度嵌套循环
- android - 具有不同枢轴的 ImageView 旋转
- ruby-on-rails - mongoid 相当于加载?
- django - 如何根据 django 模板中的字段值显示排名?
- php - 我尝试更新我 laragon 中的 php,但我得到了这个
- java - BearerTokenAccessDeniedHandler 类定义 未找到
- regex - 匹配第一个实例的正则表达式
- python - Windows:Numpy mkl_intel_thread.dll