I feel like I'm getting close if someone can just help me on the last stretch!
Currently I have the following:
{
CLLocationCoordinate2D location;
location.latitude = (double) 44.4758;
location.longitude = (double) -73.2125;
str = [[NSNumber numberWithDouble:location.longitude] stringValue];
viewController.stringToDisplay = str;
}
Now, this is passing the longitude value, but it won't of course let me include the latitude. What can I write to include both in the same line?
Thank you!
DID IT!! So happy. I pass different coordinates from a previous view based on the button pressed and am pinning those coordinates on the next view with IF statements. This is no doubt a simple thing for a programming guru, but I have no experience so I'm happy :)
-(void)viewWillAppear:(BOOL)animated
{
CLLocationCoordinate2D location;
NSLog(@"self.stringToDisplay = %@", self.stringToDisplay);
if ([self.stringToDisplay isEqualToString: @"44.48, -73.21"])
{
location.latitude = (double) 44.4758;
location.longitude = (double) -73.2125;
MapViewAnnotation *newAnnotation = [[MapViewAnnotation alloc] initWithTitle:@"Burlington, VT" andCoordinate:location];
[self.mapView addAnnotation:newAnnotation];
}
if ([self.stringToDisplay isEqualToString: @"51.50, -0.14"])
{
location.latitude = (double) 51.5010;
location.longitude = (double) -0.1425;
MapViewAnnotation *newAnnotation = [[MapViewAnnotation alloc] initWithTitle:@"Buckingham Palace" andCoordinate:location];
[self.mapView addAnnotation:newAnnotation];
}
}