Swift - PageViewController 跳转到页面

3

我有一个使用pageviewcontroller的非常简单的应用程序。使用手势可以正常工作,但如何使用按钮跳转到下一个或上一个索引/页面呢?

谢谢大家

祝好

Chris


请检查这个答案:https://dev59.com/OGYr5IYBdhLWcg3wfaSc - mgyky
克里斯托弗·克劳斯是你在寻找的人吗? - mgyky
1个回答

0

你可以初始化新的视图控制器类,并像这样将当前视图更改为新视图:

    ///In viewDidLoad 
    let myFirstButton = UIButton()
    myFirstButton.addTarget(self, action: "pressed:", forControlEvents: .TouchUpInside)
    self.view.addSubview(myFirstButton)
    //////

    func pressed(sender:UIButton!) {
        let vc = YourNewViewController() //change this to your class name
        self.presentViewController(vc, animated: true, completion: nil)
    }

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接