Created
June 23, 2014 01:12
-
-
Save eytanschulman/32f6eb6f6223728fe698 to your computer and use it in GitHub Desktop.
Best. Method. Ever.
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)changeButtonBackgroundWithAnimation:(UIButton *)button andBackground:(UIImage *)background withDuration:(CFTimeInterval)aduration { | |
[button setImage:background forState:UIControlStateNormal]; | |
CATransition *transition = [CATransition animation]; | |
transition.duration = aduration; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionFade; | |
[button.layer addAnimation:transition forKey:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment