在 collectionViewCell
中,我想创建一个底部带有点的 View ,我可以在 View 之间滑动。我应该使用 UIPageController
来显示点并手动实现手势识别,还是可以在 collectionViewCell
中使用 UIPageViewController
?
最佳答案
是的,你可以把它放在你的牢房里。它不一定是全屏。事实上,它可以用作任何其他 UIViewController。如果你想把它嵌入到一个更小的矩形中,你可以使用 UIViewController containment。
假设您想将它嵌入到父 Controller 中,该 Controller 是 UIViewController 的子类。然后定义一个pageViewController属性,在viewDidLoad中添加为 subview Controller :
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
self.pageViewController.view.frame = ... //set the frame or add autolayout constraints
[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];
[self.pageViewController didMoveToParentViewController:self];
关于ios - 在 collectionViewCell 中使用 UIPageViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45609184/