I make a photography app in the iPhone and I have these 3 classes: View Controller, CaptureManager, and IMG Processors.
ViewController:
- (IBAction) takePic: (ID) Sender {images = [CaptureManager Exceed with Multiple Versions: ^ {// Some UI related code .. [IMG Processor Process: Images]; }]; }
Capture Manager:
- (NSArray *) LeftModel Images Conclusion: ^ (Zero) Full Handler {// Take Photo Code ... Completed Hondeller (); Return arrayoffimization; }
So far it serves as desired: imgProcessor
processes images taken by captureManager
. But I do not know how it works. Back to the array of images I took when the bcos I called Handsler was completed. How was this code executed? Is it a better solution?
Thank you!
You do not need to return the value images as you argue it for cmpletionHandler block can give.
- Take (zero) with multiple images closing: (zero (^) (NSArray * picture)) completionHnadler {// Take photo code ... completionHnadler (arrayOfImagesTaken); }
You can call it like this:
- (IBAction) takePic: (ID) Sender {{CaptureManager Take Various Images End: ^ (NSArray * images) {[IMG processor process: images]; }]; }
How does this work?
The block here is used as a callback, this code defines the task to execute when a task is completed. When multiple image ending has been concluded, the block will be called fullholder.
Comments
Post a Comment