3

I have a very simple app using a pageviewcontroller. This works fine using the gesture but how can I jump to the next or previous index / page using a button?

Thank you all

Cheers

Chris

Christopher Klaus
  • 462
  • 1
  • 4
  • 8
  • Please check this answer : http://stackoverflow.com/questions/13633059/uipageviewcontroller-how-do-i-correctly-jump-to-a-specific-page-without-messing – MGY Jun 12 '15 at 13:02
  • Christopher Klaus is it what you're looking for? – MGY Jun 12 '15 at 13:12

1 Answers1

0

you can init your new View Controller class and change the current view to new view like that:

    ///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)
    }
Özgür Ersil
  • 6,909
  • 3
  • 19
  • 29