Return object at Index number from Array
How do I determine the index number of X
in an array sorted by Y
?
I want to say something like "The 6th record out of 26" where [array count] is 26 and 'F' is the record I'm looking for in an开发者_StackOverflow中文版 array containing the alphabet?
You can use:
[array indexOfObject:@"F"];
This would return 6
and:
[array objectAtIndex:6];
Which would return F
Use the indexOfObject (or the like, according to your needs and object) message or the like on the array
Look at Apple's NSArray Class reference here and go the Instance methods section.
精彩评论