Tuesday, 27 August 2013

How to know the IndexOfObject in NSArray

How to know the IndexOfObject in NSArray

I am trying to fetch the index position by passing the array objects.I
have an NSArray with name fruits and I gave 4 fruit names in that array as
below In my header file
NSArray *mFruits;
and in my implementation file
mFruits = [[NSArray alloc] initWithObjects: @"Apple", @"Mango",
@"Grape",@"Banana",nil];
now I am getting the array objects means(Apple,Grape,..) in one text field
now I want to know the index of the fruit in that array i.e., If "Apple"
is the text fetched from the text field then I should know the index as
"0" for .
Many Thanks

No comments:

Post a Comment