Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

I need help with Animation Callbacks (iPhone)

By: a guest on Feb 27th, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }