1

So I have a flow in my app where all the view controllers have the same gradient background (using a UIImageView).

I’m presenting each of them modally with a cross-dissolve transition as opposed to using a navigation controller because I don’t want the horizontal push/pop transition. Is there a better way to do this? Perhaps using a navigation controller and disabling the push/pop animation and just fading/pushing the UI elements into the view?

I want it to look like the background never changes through the workflow, but the ui elements/contents for each view controller do change.

1 Answers1

0

You could provide a custom push / pop animation, if the animation is fairly easy to do.:

[UIView animateWithDuration:0.75
                         animations:^{
                             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                             [self.navigationController pushViewController:nextView animated:NO];
                             [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
                         }];

[UIView animateWithDuration:0.75
                         animations:^{
                             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                             [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
                         }];
[self.navigationController popViewControllerAnimated:NO];

Source.


If the animation isn't so easy, it's perfectly fine to present your view controllers modally if you don't need the navigation bar, but you'll have to provide your own popToViewController:animated: equivalent (since I don't know any way to dismiss more than one view controller).

Community
  • 1
  • 1
Lord Zsolt
  • 6,492
  • 9
  • 46
  • 76