我正在尝试找到一种通过按钮进行放大和缩小的方法。如果我将代码放入方法didAddAnnotationViews
中,它将完美地设置初始缩放。我试图用下面的代码来改变缩放,但它一直在崩溃说:
无法识别的选择器发送到实例
如何在 IBAction 中运行它?
-(IBAction)ZoomIn:(MKCoordinateSpan)coordinateSpanWithMapView:(MKMapView *)mv centerCoordinate:(CLLocationCoordinate2D)location
{
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.05;
span.longitudeDelta=0.05;
location = mv.userLocation.coordinate;
location = mv.userLocation.location.coordinate;
region.span=span;
region.center=location;
[mv setRegion:region animated:TRUE];
[mv regionThatFits:region];
};