SHARE
TWEET

I need help with Animation Callbacks (iPhone)

a guest Feb 27th, 2012 15 Never
  1. [UIView beginAnimations:nil context:NULL];
  2. [UIView setAnimationDuration:ANIMATIONDURATIONINSECONDS];
  3. [UIView setAnimationDelegate:self];
  4. [UIView setAnimationDidStopSelector:@selector(yourAnimationHasFinished:finished:context:)];
  5. // Change property or properties here
  6. [UIView commitAnimations];
  7.        
  8. - (void)yourAnimationHasFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context;
  9.        
  10. [animation setValue:"firstAnimation" forKey:@"name"];
  11.        
  12. - (void)animationDidStop:(CAAnimation*)animation finished:(BOOL)finished {
  13.   if([[animation valueForKey:@"name"] isEqual:@"firstAnimation"] && finished) {
  14.     ...
  15.   }
  16. }
RAW Paste Data
Top