Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iSapozhnik/5a08b827e5f2ca0c59c9f6d31f1ebc6a to your computer and use it in GitHub Desktop.
Save iSapozhnik/5a08b827e5f2ca0c59c9f6d31f1ebc6a 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