Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 18th, 2012  |  syntax: None  |  size: 0.76 KB  |  hits: 11  |  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 animation not going back to original state
  2. [UIView beginAnimations:nil context:NULL];
  3. [UIView setAnimationRepeatCount:2];
  4. [UIView setAnimationRepeatAutoreverses:YES];
  5. [UIView setAnimationDuration:0.3];
  6. [UIView setAnimationBeginsFromCurrentState:YES];
  7. textDetailView.layer.backgroundColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:0.3].CGColor;
  8. [UIView commitAnimations];
  9.        
  10. CABasicAnimation *myColorAnimation = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
  11. [myColorAnimation setAutoreverses:YES];
  12. [myColorAnimation setRepeatCount:2];
  13. [myColorAnimation setDuration:0.3];
  14. [myColorAnimation setToValue:(id)[myColor CGColor]];
  15. // the default "from value" is the current value
  16. [[textDetailView layer] addAnimation:myColorAnimation forKey:@"myColorKey"];