【问题标题】:Swift - PageViewController jump to pageSwift - PageViewController 跳转到页面
【发布时间】:2015-06-12 12:53:17
【问题描述】:

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

谢谢大家

干杯

克里斯

【问题讨论】:

标签: ios swift uipageviewcontroller


【解决方案1】:

您可以像这样初始化新的 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)
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    相关资源
    最近更新 更多