I worked with NSMutableArray and had no problem returning an object from an array using objectAtIndex:int . Instead of pulling an object from an array with an integer, this is a way to get the index position by searching for an 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)
I hope this makes sense, and there is an answer, I could not do research on the Internet and find anything through google or apple links.
cocoa nsmutablearray
bbullis21 01 Sep '09 at 17:07 2009-09-01 17:07
source share