Created
November 27, 2011 13:58
-
-
Save curthard89/1397591 to your computer and use it in GitHub Desktop.
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 NSAnimationContextRunAnimationBlock( dispatch_block_t group, dispatch_block_t completionHandler, NSTimeInterval time ) | |
{ | |
[NSAnimationContext runAnimationBlock:group | |
completionHandler:completionHandler | |
duration:time]; | |
} | |
+ (void)runAnimationBlock:(dispatch_block_t)group | |
completionHandler:(dispatch_block_t)completionHandler | |
duration:(NSTimeInterval)time | |
{ | |
// run animation | |
[NSAnimationContext beginGrouping]; | |
[[NSAnimationContext currentContext] setDuration:time]; | |
group(); | |
[NSAnimationContext endGrouping]; | |
// block delay | |
dispatch_time_t popTime = dispatch_time( DISPATCH_TIME_NOW, (double)time * NSEC_PER_SEC); | |
dispatch_after( popTime, dispatch_get_main_queue(), completionHandler ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment