It's only anonymous/inline to you. "sortedArrayUsingComparator:" is declared like this:
- (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr This means that inside the implementation of this method, "cmptr" refers to the block, and will be invoked like this: cmptr(object1, object2); Dave On Sep 17, 2010, at 8:07 PM, ico wrote: > Hi Dave, > > I think you misunderstood me, if a block declared with a block variable > reference to it, of > course we can call it like we would with a function pointer. What I don't > know how to invoke > the block is the case which we don't even have a function pointer to it, this > happens when > we implement an inline block, such as: > > stringsArray sortedArrayUsingComparator:^(id string1, id string2) { > blah, blah; > }]; > > inside the sortedArrayUsingComparator implementation, we have an argument > which is a > block, but in this case, that is an inline block, just block arguments are > declared(string1 and > string2), we don't have a block variable though. So inside the > sortedArrayUsingComparator > implementation, how we can invoke that block?
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com