Can I setup a function to be called once my animation is complete? I want to fade a UIView
and then remove it from the superView
.
Animation blocks were introduced in iOS4. Apple recommends you use these, and the new methods mostly ask for completion blocks which replace callbacks. For example:
[UIView animateWithDuration:0.5f
delay:0.0f
options:UIViewAnimationCurveEaseInOut
animations:^{
[myView setAlpha:0.0f];
}
completion:^(BOOL finished) {
[myView removeFromSuperview];
}];