Skip to content

Instantly share code, notes, and snippets.

@steipete
Created August 27, 2011 12:54
Show Gist options
  • Save steipete/1175357 to your computer and use it in GitHub Desktop.
Save steipete/1175357 to your computer and use it in GitHub Desktop.
Easy [fade] animation for UIImageView.image
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
selected_ = selected;
if (animated) {
CATransition *transition = [CATransition animation];
transition.duration = 0.25f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;
[self.selectionImageView.layer addAnimation:transition forKey:nil];
}
self.selectionImageView.image = [UIImage imageNamed:selected ? @"radio-cell-selected" : @"radio-cell-deselected"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment