0

I'm making an app for iOS 5 which displays one UIViewController at a time with no navigation bar.

UIPageViewController is almost perfect for what I want to achieve except it only provides the page curl transition animation for iOS 5.

I found an alternative but it's a bit of a hack. I created a UINavigationController and set the navigation bar to hidden.

When navigating forward I call

[navigationController setViewControllers:@[newVC] animated:YES];

And when navigating back I call

[self.navigationController setViewControllers:@[prevVC, currentVC] animated:NO];
[self.navigationController popViewControllerAnimated:YES];

This hack seems to work and gives me the exact transition I want, but there has to be a better way.

I'm thinking another alternative will be to use UIView animation blocks. But that will require a bit more work.

RohinNZ
  • 3,338
  • 5
  • 24
  • 34

1 Answers1

1

It looks like I should be able to achieve what I'm after using these two functions in UIViewController:

addChildViewController:

and

transitionFromViewController:toViewController:duration:options:animations:completion:

These functions became available in iOS 5. I should have properly read through all the new iOS 5 features first.

RohinNZ
  • 3,338
  • 5
  • 24
  • 34
  • 1
    There are many issues with UIPageViewController scroll style animation, it crashes in many cases and also has some internal caching issue that stops it from updating UI properly. Ref: http://stackoverflow.com/a/21463024/844295 and http://stackoverflow.com/a/14863241/844295 – Yogesh Maheshwari Sep 26 '14 at 13:39