Skip to content

Instantly share code, notes, and snippets.

@ziggear ziggear/gist:9206330
Created Feb 25, 2014

What would you like to do?
using block and callback
//block declare:
typedef int (^startBlock)(int a, int b);
typedef int (^endBlock)();
- (void) runBlock:(startBlock)_startBlock end:(endBlock)_endBlock{
int a = _startBlock(1,2);
int b = _endBlock();
NSLog(@"start block result : %d", a);
NSLog(@"end block result : %d", b);
//run block:
[self runBlock:^int(int a, int b) {
NSLog(@"args from run-block : %d, %d ", a, b);
return 1;
} end:^int{
return 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.