Skip to content

Instantly share code, notes, and snippets.

View alanjrogers's full-sized avatar
💭
I may be slow to respond.

Alan Rogers alanjrogers

💭
I may be slow to respond.
  • Melbourne, Australia
View GitHub Profile
@alanjrogers
alanjrogers / UIImageView+CATransition.m
Created November 11, 2010 03:00
Sample code showing how to add a CATransition to changing the image on a UIImageView
UIImage* newImage = [UIImage imageNamed:context];
// set up an animation for the transition the content
CATransition *animation = [CATransition animation];
[animation setDuration:0.25];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[self.contentImageView layer] addAnimation:animation forKey:@"SwitchToView1"];