Skip to content

Instantly share code, notes, and snippets.

@sodastsai
Created March 27, 2012 04:32
Show Gist options
  • Select an option

  • Save sodastsai/2212557 to your computer and use it in GitHub Desktop.

Select an option

Save sodastsai/2212557 to your computer and use it in GitHub Desktop.
UIView animation
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
view.backgroundColor = [UIColor yellowColor];
[self.window addSubview:view];
void (^keyframe1)(void) = ^{
view.frame = CGRectMake(100,100,100,100);
view.backgroundColor = [UIColor redColor];
};
void (^keyframe2)(void) = ^{
view.backgroundColor = [UIColor blackColor];
};
[UIView animateWithDuration:3 animations:keyframe1 completion:^(BOOL finished) {
[UIView animateWithDuration:3 animations:keyframe2];
}];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment