Swift - PageViewController跳转到页面

时间:2015-06-12 12:53:18

标签: ios swift uipageviewcontroller

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

谢谢大家

干杯

克里斯

1 个答案:

答案 0 :(得分:0)

您可以初始化新的View Controller类,并将当前视图更改为新视图:

    ///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)
    }
相关问题