【问题标题】:MapKit range zoomMapKit 范围缩放
【发布时间】:2012-05-05 21:18:57
【问题描述】:

有没有办法根据您拥有的注释范围查看地图?这样就不会留下任何引脚

//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];

谢谢!

【问题讨论】:

    标签: objective-c xcode mapkit


    【解决方案1】:

    看到这个帖子: Positioning MKMapView to show multiple annotations at once

    根据您要添加的注释数量,您可能需要调整链接答案中的代码以循环遍历所有注释以找到 lat/long 的最小/最大值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多