-1

I have a button 'filter' on left side on navigation bar. On clicking it I want flip animation with flip delay of 1.5 second while switching to the next view. How to add the code for that?

I am working with this navigation code:

FilterViewController *vc = [[FilterViewController alloc] init];
vc.delegate = self;

[self.delegate pushViewController:vc  animated:UIViewAnimationTransitionFlipFromLeft];

[vc release];

Now I want a flip delay of 1.5 seconds on view switch by button. I have tried some code but it's not giving me the desired result.

nikesh
  • 140
  • 1
  • 15

2 Answers2

1

Try this

    [UIView beginAnimations:@"View Flip" context:nil];
    [UIView setAnimationDuration:1.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight 
                           forView:self.navigationController.view cache:NO];

    [self.navigationController pushViewController:vc animated:YES];
    [UIView commitAnimations];

    [vc release];

taken from How to do the flip animation between two UIViewControllers while clicking info button?

Other way:

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

I get this from How to change the Push and Pop animations in a navigation based app

Community
  • 1
  • 1
CRDave
  • 9,279
  • 5
  • 41
  • 59
  • what happen when u implement this? – CRDave Dec 26 '12 at 12:55
  • the button hangs up.it does not even navigates to the nxt view. – nikesh Dec 26 '12 at 13:03
  • ProjectViewController may not respond to pushViewController .. getting this warning .. still not working – nikesh Dec 26 '12 at 13:19
  • go to reference thread of SO which I have given in my answer there are detail discussion on this topic so you may get your answer. All The Best.... – CRDave Dec 26 '12 at 13:22
  • i modified the code to this ... MainView *nextView = [[MainView alloc] init]; [UIView animateWithDuration:0.75 animations:^{ [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [self.delegate pushViewController:nextView animated:NO]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO]; }]; .. it works now but the animation makes the navigation bar buttons also animate ... – nikesh Dec 26 '12 at 13:24
  • CRDave:Thanks man the link provided by you really helped.. thxs – nikesh Dec 27 '12 at 05:25
0

Use this for delay the push animation:

FilterViewController *vc = [[FilterViewController alloc] init];
vc.delegate = self;
[self performSelector:@selector(callViewController:) withObject:vc afterDelay:1.5];

-(void)callViewController:(FilterViewController*)vc{
    [self.delegate pushViewController:vc  animated:UIViewAnimationTransitionFlipFromLeft];
    [vc release];
}
Sumanth
  • 4,913
  • 1
  • 24
  • 39
  • I want when the view flips it should flip with ease like flipping with ease in, and flipping out with ease out ... by adding this delay it simply delays the time of flip .. any method to perform the flip like ease in flip ... – nikesh Dec 26 '12 at 12:58
  • For that you should see the @CRDave answer thats how it will work – Sumanth Dec 26 '12 at 13:10