I have an iOS app with a map view. I have added an annotation to the map. I would like to programmatically move the map, so that the annotation is near the top part of the MKMapView.
This is what is currently happening:
I want to move the map so that the annotation is shown like this:
This is the code that I have tried so in order to add the annotation, but I can't get the map to move in the correct place:
// Set the map view coordinates.
MKCoordinateRegion region = { {0.0, 0.0}, {0.0, 0.0} };
region.center.latitude = coordinate.latitude;
region.center.longitude = coordinate.longitude;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[main_map setRegion:region animated:YES];
// Set the map view pin.
MapViewer *ann = [[MapViewer alloc] init];
ann.title = @"British Red Cross shop";
ann.subtitle = @"Unit 4 Borough Fields Shopping Centre, Royal Wootton Basset";
ann.coordinate = region.center;
[main_map addAnnotation:ann];