Using an animation delegate can make it less "hacked":
[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; [myLabel setAlpha:0.0]; [UIView commitAnimations];
And then you can restart the didStopSelector animation:
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [self displayLabel]; }
Depending on the animation id, you can perform different actions, etc. Using the UIView setAnimationDelay may also come in handy.
UIView also has a setDuration call for animations:
[UIView setAnimationDuration:0.1]
If you are creating for iOS4, check out the documentation, as you should use block-based animation calls, not based on these delegates.
source share