I am trying to translate the following JS code in ObjC; It basically defines the function and stores it in an array for later execution:
var logic = function() { me.removeNode(node); } this.queue.push(logic);
My ObjC port contains a method: -(void)removeNode:(AbstractNode*)node and I'm stuck ... I would just like to queue this method using the specified node argument ...
edit: I read about selectors. It is still blurring, but it can help. Somehow. Or not?
Is this possible, or do I need to find a workaround :-)? Thanks!
The solution to this is thanks to the community:
// Queue declaration NSMutableArray *IRQ = [[NSMutableArray array] retain]; // Add logic to the queue for delayed execution: [IRQ addObject:^{ NSLog(@"thanks for the help!"); } ]; // Call later for (int i = 0; i < [IRQ count]; i++){ void (^delayedCall)(void) = [IRQ objectAtIndex:i]; delayedCall(); }
Jem
source share