2

I like the default "push" animation that the UINavigationController uses, but I want to slow it down to about 1.0 seconds. Any advice?

PS- I tried using CATransition with kCATransitionPush and kCATransitionFromRight, but i got a weird fade-to-white effect that was undesirable.

user1007895
  • 3,925
  • 11
  • 41
  • 63
  • Duplicate: http://stackoverflow.com/questions/2215672/how-to-change-the-push-and-pop-animations-in-a-navigation-based-app – Jeshua Lacock Jan 27 '12 at 01:37

2 Answers2

0

In my app (flashcard app) I use this code:

FlashCardFlipVC * flipvc = [[FlashCardFlipVC alloc] initWithFlashCardData:_card];
flipvc.navigationItem.title = self.navigationItem.title;

[UIView  beginAnimations:@"ShowAnswers" context: nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController: flipvc animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
[UIView commitAnimations];

[flipvc release];

It sets different than normal animation pattern (curl up instead of slide) and different time setting. You can use your own of course.

Peter Sarnowski
  • 11,900
  • 5
  • 36
  • 33
  • This works for alternative animations, but I want to keep the push-from-the-right effect. As far as I know, this way does not allow that. – user1007895 Jan 27 '12 at 04:05
-3

Have you tried setting setAnimationDuration:?

Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58
  • Before you "push" run that method (eg maybe when you instantiate it) from your navcontroller eg: [nav setAnimationDuration:0.5f]; – Jeshua Lacock Jan 27 '12 at 04:07
  • nav? do you mean this? 'GameViewController *game = [[GameViewController alloc] init]; [UIView setAnimationDuration:1.0]; [self.navigationController pushViewController:game animated:YES]; ' because this doesnt work – user1007895 Jan 27 '12 at 04:52
  • Well since you didn't show any source code, I had no idea what your navigation controller was called. What I mean is this (before pushing): [self.navigationController setAnimationDuration:0.5f]; – Jeshua Lacock Jan 27 '12 at 05:11
  • 1
    UINavigationController doesn't have a setAnimationDuration method. – user1007895 Jan 27 '12 at 14:13
  • It inherits UIView that does however. – Jeshua Lacock Jan 27 '12 at 22:44