I have the simple code of:
[otherClass doMethodOneWhichHasAnimation];
and that animation lasts 0.8 seconds. Followed by code that pushes a viewcontroller:
SchemeView *schemeView = [[SchemeView alloc] init];
[self.navigationController pushViewController:schemeView animated:YES];
[schemeView release];
The problem is, it pushes the viewcontroller without waiting, and I'd like it to wait. Doing delay just delays the whole thing, including the first animation from starting.
How can i get it to wait the 0.8 seconds before running the second bit of code?
You can push after the animation is done
[UIView animateWithDuration:0.8
animations:^{
// Animation
}
completion:^(BOOL finished){
// PushView
}];
for < iOS 4+ take a look at setAnimationDidStopSelector
or
[self performSelector:@selector(metohodToPushView) withObject:nil afterDelay:0.8];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With