I'm using the Google Places API to show places near the user's location. When they tap on a pin, the annotation view pops up with the name and the vicinity. There's also a detail disclosure button that segues into a detail view controller which is supposed to show all the details of that specific place.
Here is how I get the data of ALL the names, place id's, and image strings for ALL the places near the user:
NSArray* places = [json objectForKey:@"results"];
NSArray *icons = [places valueForKey:@"icon"];
NSArray *placeIDs = [places valueForKey:@"place_id"];
NSArray *names = [places valueForKey:@"name"];
for (NSString *imgString in icons)
{
NSLog(@"%@", imgString);
}
for (NSString *placeID in placeIDs)
{
NSLog(@"%@", placeID);
}
for (NSString *theName in names)
{
NSLog(@"%@", theName);
}
if ([places count] == 0)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"Couldn't find any of those places near you" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:@"Cancel", nil];
[alertView show];
}
[self plotPositions:places];
So as you can see I'm just looping through the arrays and retrieving ALL the data. Now all I want to do is retrieve the data of the place that the user has TAPPED on.
All help is appreciated, thanks in advance