I have some image processing that take much time and resources, so i use NSOperation
+ NSOperatioQueue
+ delegate for callBack. and all work.
now i want to use blocks because its much elegant and simple to use in a tableView for example.
what i need to do is just like AFJSONRequestOperation
for example:
NSURL *url = [NSURL URLWithString:@"url"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSLog(@"App.net Global Stream: %@", JSON);
} failure:nil];
[operation start];
in this example i don't see any operationQueue ! how can i do the same?
[ImageManagerOperation modifyImage:(UIImage*)image completitionBlock:(void (^)(UIImage *modifiedImage))complete];
where ImageManagerOperation is an NSOperation.
I know that i can set a Completion Block, but i still need to add the operation in a queue.
i want to minimize the line number in my code (if possible :) ).