sortedArrayUsingFunction:context: and other variables
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