:
for (int i = 0; i < [tours count]; i++) {
NSDictionary *tourDictionary = [tours objectAtIndex:i];
NSString *tempTour = [tourDictionary objectForKey:@"City"];
if ([tempTour isEqualToString:_toursAvailable]) {
self.options = [tourDictionary objectForKey:@"Options"];
}
}
, , @"City" .
:
NSString *path = [[NSBundle mainBundle] pathForResource:@"Destination" ofType:@"plist"];
NSArray *destinations = [NSArray arrayWithContentsOfFile:path];
[destinations enumerateObjectsUsingBlock:^(id destObj, NSUInteger idx, BOOL *stop) {
NSUInteger index = [destObj[@"Tours"] indexOfObjectPassingTest:^BOOL(id tourObj, NSUInteger idx, BOOL *stop) {
return [tourObj[@"City"] isEqualToString:_toursAvailable];
}];
if( index != NSNotFound ) {
self.options = destObj[@"Tours"][index][@"Options"];
*stop = YES;
}
}];
, UITableViewController toursAvailable, OptionsViewController. , .
, , :
. , , .. ? , plist; , -API - . . - . , , , ..