Skip to content

Instantly share code, notes, and snippets.

@jyliang
Last active August 29, 2015 14:01
Show Gist options
  • Save jyliang/7f8887f78a68cbfad119 to your computer and use it in GitHub Desktop.
Save jyliang/7f8887f78a68cbfad119 to your computer and use it in GitHub Desktop.
animation on/off block
- (void)modifyView:(UIView *)view animated:(BOOL)animated {
void (^block)() = ^{
//modify view animation progress
};
void (^completion)(BOOL) = ^(BOOL finished){
//modify view completion
};
if (animated) {
[UIView animateWithDuration:0.25f animations:block completion:completion];
} else {
block();
completion(YES);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment