PageViewController showing a black screen

久未见 提交于 2019-12-05 23:53:00
Navneet Gill

On loading your controller you have to set your initial page by using this code

override func viewDidLoad() {
    super.viewDidLoad()
    dataSource = self;
    self.setViewControllers([getViewControllerAtIndex(index: 0)] as [UIViewController], direction: UIPageViewControllerNavigationDirection.forward, animated: false, completion: nil)
}

func getViewControllerAtIndex(index: Int) -> ReservedTimesTableViewController
{
    // Create a new view controller and pass suitable data.
    let reservedTimesTableViewController = self.storyboard?.instantiateViewController(withIdentifier: "ReservedTimesTableViewController") as! ReservedTimesTableViewController
    return reservedTimesTableViewController
}

After when you try to scroll your page then the datasource methods will do their work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!