I have the following method:
-(UIImage *)flagFromOrigin:(NSString *)originString {
NSRange range;
for (NSString *arrayString in countryArray) {
range = [[originString lowercaseString] rangeOfString:arrayString];
if (range.location != NSNotFound) {
return [UIImage imageNamed:[NSString stringWithFormat:@"%@.png", arrayString]];
}
}
return nil;
}
Earlier in the class I init an NSArray *countyArray and add file names (@"united states", @"canada", @"germany", @"denmark", etc.).
I was hoping someone could tell me a better way so I don't have to create the array to loop through, but if I could instead look directly at the file names? This way I don't have to add 200+ NSString objects to the array and possible overlook a whole bunch.
Thanks