This is my first App, and basically consists of making locations available in a UITable (app entry point) and querying them in a MapKit (StoryBoard model). How can I make the call?
I am trying to use an NSDictionary for the values in the table and then the PrepareForSegue method. Is it possible to include specific coordinates in the Dictionary or in a separate Array? And how to specify in the PrepareForSegue method?
The code:
@implementation TableViewController
- (void)viewDidLoad {
[super viewDidLoad];
_citySpots = @{@"Bars" : @[@"Hurricane", @"Black Swan", @"Texas"],
@"Clubs" : @[@"Electric Wizard", @"Offspring", @"The Tunnel"],
@"Restaurants" : @[@"Nando's", @"1/2 Burguer", @"Satellite"],
};
_sectionTitles = [[_citySpots allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
}
The PrepareForSegue method:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"spotsDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
MapViewController *destViewController = segue.destinationViewController;
NSString *sectionTitle = [_sectionTitles objectAtIndex:indexPath.section];
NSArray *citySpots = [_citySpots objectForKey:sectionTitle];
//coordenadas?
}
}