我试图找到一种方法,通过按钮进行放大和输出。如果我将代码放入方法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];
};发布于 2012-01-17 04:33:28
我的问题是,我试图在IBAction行中传递IBAction,而这是我做不到的。它不知道该怎么处理它。我在代码中引用了我的MapView,而不是试图在方法中传递它.
CLLocationCoordinate2D location;
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=1.00;
span.longitudeDelta=1.00;
location = self.myMap.userLocation.coordinate;
location = self.myMap.userLocation.location.coordinate;
region.span=span;
region.center=location;
[self.LightUpMap setRegion:region animated:TRUE];
[self.LightUpMap regionThatFits:region];您现在可以将这是任何IBAction方法,它将放大到地图。
发布于 2014-01-31 07:58:17
-(void)zoomOut:btnMinus
{
MKCoordinateSpan span = mapView.region.span;
span.latitudeDelta = span.latitudeDelta * 2;
span.longitudeDelta = span.longitudeDelta * 2;
region.span=span;
[mapView setRegion:region animated:YES];
for(int j=2;j<count;j++)
{ places[j]=1;}
[self filterAnnotations];
}https://stackoverflow.com/questions/8878653
复制相似问题