I have been working with NSMutableArray and have had no problems retrieving an object from an array by using objectAtIndex:int
. Rather then pulling an object out of the array by an integer is their a way to get the index position by searching the array with a string.
animalOptions = [[NSMutableArray alloc] init];
//Add items
[animalOptions addObject:@"Fish"];
[animalOptions addObject:@"Bear"];
[animalOptions addObject:@"Bird"];
[animalOptions addObject:@"Cow"];
[animalOptions addObject:@"Sheep"];
NSString * buttonTitle = [animalOptions objectAtIndex:1];
// RETURNS BEAR
int * objectIndex = [animalOptions object:@"Bear"];
// THIS IS WHAT I NEED HELP WITH, PULLING AN INDEX INTEGER WITH A STRING (ex: Bear)
Hopefully this makes sense, and there is an answer out there, I have been unable to research online and find anything through google or apple's class references.