我在 Mapkit 中显示了当前位置注释(蓝点)。粘贴蓝点后注释显示,
当我启动视图时,如何让注释默认显示?敲击销钉。
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views {
for(MKAnnotationView *annotationView in views) {
if(annotationView.annotation == mv.userLocation) {
self.mapView.userLocation.title= @"Current";
self.mapView.userLocation.subtitle= @"Location";
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.002;
span.longitudeDelta=0.002;
CLLocationCoordinate2D location=mv.userLocation.coordinate;
region.span=span;
region.center=location;
[mv setRegion:region animated:YES];
[mv regionThatFits:region];
}
}
}
在这种情况下, selectAnnotation 应该可以工作,不是吗?一小段时间后就执行Selector。
....与之前相同的代码,但插入以下内容:
id annotation = annotationView.annotation;
[self performSelector:@selector(selectUserLocation:) withObject:annotation afterDelay:0.1f];
}
}
}
- (void)selectUserLocation:(id)annotation{
[self.mapView selectAnnotation:annotation animated:YES];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)