0

Is there a way to view a map based on the range of annotations that you have? So that does not leave any pin out

//Map
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 299, 406)];
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; 
region.center.latitude = [latitudeNumber doubleValue];
region.center.longitude = [longitudeNumber doubleValue];
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapView setRegion:region animated:YES]; 
[mapView setDelegate:self];
[self.view addSubview:mapView];

Thanks!

Vins
  • 1,707
  • 4
  • 22
  • 37

1 Answers1

1

See this post: Positioning MKMapView to show multiple annotations at once

Depending on how many annotations you're adding, you may have to tweak the code found in the linked answer to loop through all of your annotations to find the min/max values of lat/long.

Community
  • 1
  • 1
pdriegen
  • 1,979
  • 1
  • 12
  • 19