UITableViewCell 内的 UIPageViewController [英] UIPageViewController inside of a UITableViewCell
问题描述
嘿,我想问一下如何在 UITableViewCell 中实现 UIPageViewController.
Hey I wanted to ask how do I implement a UIPageViewController inside of a UITableViewCell.
我一直在阅读,但到目前为止,任何尝试的人似乎都无济于事.
I have been reading around, but so far nothing seems to work for anyone trying.
我希望得到一些提示,不需要完整的答案..
I would appreciate some hints, no need for a full answer..
谢谢!
推荐答案
目前还不清楚您到底要做什么,但让我看看我是否可以解释一下.您希望在表格视图单元格中拥有页面视图控制器视图.
It is unclear exactly what you are attempting to do, but let me see if I can explain. You want to have a page view controller view inside a table view cell.
您需要为每个单元格创建一个页面视图控制器,将其视图调整为单元格内容视图的大小,并将该视图添加为单元格的子视图.然后,您必须在单元格内实现页面视图控制器的数据源和委托方法.
You will need to create a page view controller per cell, resize its view to the size of the cell's content view and add the view as a subview of the cell. You will then have to implement the page view controller's datasource and delegate methods inside the cell.
类似于:
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
[self.pageViewController setDataSouce:self];
[self.pageViewController setDelegate:self];
[self.pageViewController.view setFrame:self.contentView.bounds];
self.contentView addSubview:self.pageViewController.view];
然而,这是一个奇特的设计,看起来过于复杂.
However, this is a peculiar design, which looks over-complicated.
这篇关于UITableViewCell 内的 UIPageViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!