• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to invoke and inline block which is passed as function argument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to invoke and inline block which is passed as function argument


  • Subject: How to invoke and inline block which is passed as function argument
  • From: ico <email@hidden>
  • Date: Sat, 18 Sep 2010 03:32:23 +0800

Hi All,

I just wonder how to invoke an inline block which is passed as function
argument.
We can invoke a block if we declare a block as a variable, what if you
simply implement
them inline where they are required as an argument. It seems you have
nothing reference
to that block address.

For example, NSArray class has a method as follow:
- (NSArray *)sortedArrayUsingComparator:(NSComparator)*cmptr*
*
*
*the argument cmptr can simply be an inline block like:*
*[stringsArray sortedArrayUsingComparator:^(id string1, id string2) {*
*    blah, blah;*
*}];*
*
*
*I just wonder inside the sortedArrayUsingComparator method, how to call
that block for*
*comparing two string since you don't have a reference to it. Another
example is qsort_b*
function. I just can't find the source code for those two methods.

Thanks for your help in advance.

--
==========================
Life isn't about finding yourself.
Life is about creating yourself.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to invoke and inline block which is passed as function argument
      • From: Dave DeLong <email@hidden>
  • Prev by Date: Re: bindings and NSNumberFormatter, enforcing min/max values
  • Next by Date: Re: How to invoke and inline block which is passed as function argument
  • Previous by thread: Small delay when build the view
  • Next by thread: Re: How to invoke and inline block which is passed as function argument
  • Index(es):
    • Date
    • Thread