• 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
sortedArrayUsingFunction:context: and other variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sortedArrayUsingFunction:context: and other variables


  • Subject: sortedArrayUsingFunction:context: and other variables
  • From: Aaron Wallis <email@hidden>
  • Date: Mon, 6 Aug 2007 07:03:15 +1000

I'm trying to sort an array using the sortedArrayUsingFunction:context:
method, however, the function i'm writing needs to be aware of other variables around it.


int orderWordsByUseInDictionary ( id tWord1, id tWord2, void * reverse )
{
int word1Count = [[indexedWordsWithCounts objectForKey:tWord1] intValue];
int word2Count = [[indexedWordsWithCounts objectForKey:tWord2] intValue];


	if ( word1Count > word2Count )
	{
		return NSOrderedAscending;
	}
	else if ( word1Count < word2Count )
	{
		return NSOrderedDescending;
	}
	else
	{
		return NSOrderedSame;
	}
}

when it comes to compiling, I get the error "'indexedWordsWithCounts' undeclared (first use in this function)" cause its a parameter of the object and the function can't seem to access it.

Is there anyway of making the function aware of the dictionary? since it requires the dictionaries data to properly sort the array.

Cheers

________________________/Az.________

Aaron Wallis
http://isnot.tv


_______________________________________________

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: sortedArrayUsingFunction:context: and other variables
      • From: Boyd Collier <email@hidden>
    • Re: sortedArrayUsingFunction:context: and other variables
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Associate, NSView in main window, and disable objects on panel
  • Next by Date: Re: Drag with NSTableview
  • Previous by thread: Re: dealloc for cleanup versus freeing memory
  • Next by thread: Re: sortedArrayUsingFunction:context: and other variables
  • Index(es):
    • Date
    • Thread