1

我在注释视图中有问题当我第一次在注释中点击它标注完美并在 MapView 中心设置注释但在我更改区域并再次点击注释后它只是在地图视图中心但现在标注气泡。请检查下面的 DidselectAnnotationView 方法是否有问题。

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
 {

    region.center.latitude =  view.annotation.coordinate.latitude ;
    region.center.longitude = view.annotation.coordinate.longitude;

   CLLocationCoordinate2D pointLocation =
  CLLocationCoordinate2DMake(view.annotation.coordinate.latitude,     
  view.annotation.coordinate.longitude);
  [self.mapViewAlert setCenterCoordinate:pointLocation animated:TRUE];

   [(MKMapView*)self.mapViewAlert selectAnnotation:myAnnotation animated:YES];

  }
4

1 回答 1

0

尝试。

MKCoordinateRegion region = { { 0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude =  view.annotation.coordinate.latitude ;
region.center.longitude = view.annotation.coordinate.longitude;

region.span.longitudeDelta = 0.05f;
region.span.longitudeDelta = 0.05f;
[self.mapView setRegion:region animated:YES];
于 2016-06-18T17:24:51.080 回答