【发布时间】:2018-09-06 09:39:38
【问题描述】:
我已经在容器视图中完成了 pageviewcontroller 我可以使用编程来显示页面控制,但我的容器视图是通过使用情节提要完成的,所以我不知道如何在容器中心内显示页面控制器。所以,我现在使用故事板页面控制器 ui 对象拖放它如何连接我的页面视图控制器方法以及如何通过使用 pageviewcontroller 图像数组计数来移动点。
func configurePageControl() {
// The total number of pages that are available is based on how many available colors we have.
//pageControl = UIPageControl(frame: CGRect(x: 0,y: UIScreen.main.bounds.maxY - 50,width: UIScreen.main.bounds.width,height: 50))
pageControl = UIPageControl(frame: CGRect(x: self.containerview.frame.size.width / 2, y: self.containerview.frame.size.height - 50,width: UIScreen.main.bounds.width,height: 50))
self.pageControl.numberOfPages = pageTitles.count
self.pageControl.currentPage = 0
self.pageControl.tintColor = UIColor.black
self.pageControl.pageIndicatorTintColor = UIColor.white
self.pageControl.currentPageIndicatorTintColor = UIColor.black
//self.containerview.addSubview(pageControl)
}
// MARK: Delegate functions
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
let pageContentViewController = pageViewController.viewControllers![0]
//self.pageControl.currentPage = pageTitles.index(of: pageContentViewController)!
}
【问题讨论】:
标签: ios swift uipageviewcontroller uipagecontrol