views:

42

answers:

1

For custom animations in my app, I can use the setAnimationDidStopSelector: method to respond to the event that an animation has finished. Is there a similar kind of mechanism for detecting that the animation has finished for a standard View Controller animation transition for pushes and pops?

(i.e. [self.navigationController pushViewController:vc animated:YES])
+2  A: 

I think you can try to overide the method:

- (void)viewDidAppear:(BOOL)animated

This method will be called after your view appeared

In the interface comment for the code:

- (void)viewWillAppear:(BOOL)animated;    // Called when the view is about to made visible. Default does nothing

- (void)viewDidAppear:(BOOL)animated;     // Called when the view has been fully transitioned onto the screen. Default does nothing

So I think that if you override the viewDidAppear and put your logic here, the code will be executed exactly after the transition finished

More in viewWillAppear and viewDidAppear

vodkhang
Yeah, `viewDidAppear:` will be called when your view is done animating being shown and `viewDidDisappear:` when it's done animating showing another view controller.
lucius