Created
October 24, 2010 15:20
-
-
Save steipete/643594 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
// some credits go to http://www.mikeash.com/pyblog/friday-qa-2009-08-14-practical-blocks.html | |
typedef void (^BasicBlock)(void); | |
void RunAfterDelay(NSTimeInterval delay, BasicBlock block) { | |
[[[block copy] autorelease] performSelector:@selector(ps_callBlock) withObject:nil afterDelay:delay]; | |
} | |
@implementation NSObject (BlocksAdditions) | |
- (void)ps_callBlock { | |
void (^block)(void) = (id)self; | |
block(); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment