UIPageViewControllerDelegate
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
let viewer = pageViewController.childViewControllers[0] as! KKPhotoViewerController //So I got controller is a constant
print(pageViewController.childViewControllers)
print(previousViewControllers)
photos.selectedIndex = viewer.photoIndex
currentViewer = viewer
}
答案 0 :(得分:0)
试试这个:
if self.pageViewController?.viewControllers?.count > 0 {
let currentController = self.pageViewController?.viewControllers![0]
}