NSArray has indexOfObjectWithOptions:passingTest: this will allow you to search in reverse order.
For instance:
NSArray *myArr = @[@"apple", @"oranges", @"pears", @"apple", @"bananas"]; NSString *target = @"apple"; NSUInteger index = [myArr indexOfObjectWithOptions:NSEnumerationReverse passingTest:^BOOL(NSString *obj, NSUInteger idx, BOOL *stop) { return [target isEqualToString:obj]; }];
More information on this method can be found in Apple's documentation .
source share