Skip to content

Instantly share code, notes, and snippets.

@myell0w
Created April 14, 2014 10:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myell0w/10634621 to your computer and use it in GitHub Desktop.
Save myell0w/10634621 to your computer and use it in GitHub Desktop.
UIView queued animations
@implementation UIView (AnimationQueue)
+ (void)mtd_animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion semaphore:(dispatch_semaphore_t)semaphore {
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
[self animateWithDuration:duration animations:animations completion:^(BOOL finished) {
dispatch_semaphore_signal(semaphore);
if (completion) {
completion(finished);
}
}];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment