-
-
Save iSapozhnik/5a08b827e5f2ca0c59c9f6d31f1ebc6a to your computer and use it in GitHub Desktop.
Easy [fade] animation for UIImageView.image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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