MapView不会缩放到注释

时间:2013-06-24 01:33:21

标签: ios mkmapview

我在MKMapView上创建了一个注释,然后对其进行编码,以便缩放到该注释,但它不起作用。我究竟做错了什么?

以下是代码:

[mapview setMapType:MKMapTypeStandard];
[mapview setZoomEnabled:YES];
[mapview setScrollEnabled:YES];

CLLocationCoordinate2D center = CLLocationCoordinate2DMake(40.495554, -80.055538);
MKCoordinateSpan span = MKCoordinateSpanMake(0.01f,0.01f);
MKCoordinateRegion region = MKCoordinateRegionMake(center,span);

newClass *ann = [[newClass alloc]init];
ann.title = @"Romans Dojo";
ann.subtitle = @"Belview PA";
ann.coordinate = region.center;
[mapview addAnnotation:ann];

[mapview setRegion: region animated: YES];
region.center.latitude = 40.495554;
region.center.longitude = -80.055538;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;

1 个答案:

答案 0 :(得分:0)

mapView.map.region = MKCoordinateRegionMakeWithDistance(center, 600, 600);