0

As we know Alert view is shown as modally. I am not sure if this is possible. I want to animation to start only when user press OK on Alert View

AlertView code:

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Search" message:@"Not Available" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

Animation code :

    NSInteger tabBarIndex = 3;
UITabBarController *myTabBar = self.tabBarController;
UIView *searchView = myTabBar.selectedViewController.view;
UIView *aboutView = [[[myTabBar viewControllers] objectAtIndex:tabBarIndex] view];
//animation
[UIView transitionFromView:searchView
                    toView:aboutView duration:1
                   options:UIViewAnimationOptionTransitionFlipFromRight                    completion:^(BOOL finished) {
                       if(finished)
                       {
                           myTabBar.selectedIndex = tabBarIndex;

                       }
                   }
 ];

is there anyway to do this ?

Alok C
  • 2,787
  • 3
  • 25
  • 44

1 Answers1

1

Yes its possible.

Using UIAlertView's delegate method: alertView:clickedButtonAtIndex: you can check which button was pressed and start the animation when that happens.

Robert J. Clegg
  • 7,231
  • 9
  • 47
  • 99
  • Thx, I was at documentation. Had feeling after reading it. but was not sure let me try it out. – Alok C Aug 02 '14 at 16:36
  • You must make sure your ViewController also conforms to UIAlertView delegate before that method will be called. If you alertView only has one button - the clickedButtonAtIndex value is 0. Let me know if you need more help. I use this delegate a lot in my app. Good luck and happy coding – Robert J. Clegg Aug 02 '14 at 16:41
  • Totally awesome. I cant believe I was so close. thanks a lot. Its perfect now. :) – Alok C Aug 02 '14 at 16:42