Created
August 27, 2011 12:54
-
-
Save steipete/1175357 to your computer and use it in GitHub Desktop.
Easy [fade] animation for UIImageView.image
This file contains 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