1

There are a couple of explanations on how UIPageViewControllers work, and I have read them. I have built an app based on the approach in Neil Smyth's excellent 'iPhone iOS 6 Development Essentials" in chapter 28. It is elegant and simple.

It seems a relatively simple thing to add a method to this class, and a button to the main app view, to cause the UIPageViewController to turn to a specific page. But I cannot quite see the beset way to do this.

If someone could point me to the solution -- or tell me how to add a method that would I think use the provided "viewControllerAtIndex:" method cause the page turn i want.

Seeing this done (exactly what code codes where) in that app would help me understand and point the way to a solution in my own app.

thanks everyone sorry i know this should be obvious from the ansers to the likes of this question link but i am not quite getting it.

Community
  • 1
  • 1
harry
  • 340
  • 4
  • 13
  • I got a great solution from a non-stackOverflow source. The solution involved setting up a delegate on the top level page view controller and passing the button clicks on the ContentViewController to the delegate. The top level controller had to be extended to keep track of the currentIndex so that the skip forward or skip back functions, could load the right pages. Happy to share if others are interested. – harry Nov 05 '12 at 04:49

1 Answers1

1

As noted in my comment I can close this question as I've found a good solution. As I wanted both "skip ahead" and "skip back" as well as "jump to page", I used a solution that involved specifying the top level View Controller as a delegate to content view controller, keeping track of the current page, and then passing the clicks on contentViewController back up to the implementation of the top level controller (as delegate) to move to the new page(s).

I have posted the source code for this solution as part of the "A-B-C Picture Book" source code. This app is in the app store; see https://itunes.apple.com/us/app/a-b-c-picture-book/id578864421?ls=1&mt=8.

Zoe
  • 27,060
  • 21
  • 118
  • 148
harry
  • 340
  • 4
  • 13
  • Have added a link to the source code above. or download directly with http://www.newportcoastsoftware.com/ABClgv1.0.zip – harry Nov 22 '12 at 16:05
  • I want to point out that your solution works when you are using page curl transition, but does not work when using scroll transition. For example, if I modify your code to use scroll transition and jump from page A to page L and then swipe to go to the previous page it goes to page A not page K. For some reason with scroll transition it doesn't bother to call the data source to see what page is before and automatically assumes that it should be the page you came from. –  Dec 07 '12 at 04:08
  • That's great information. But you kinda start off by saying 'your code doesn't work if i change it' so i hope people read it carefully. Then perhaps someone (@apple-delegates?) will find my source code of value and vote my answer up. But again, good point and thanks for the info. – harry Dec 08 '12 at 05:12