jjzjj

dequeueReusableAnnotationViewWith

全部标签

ios - 每次创建新注释 - dequeueReusableAnnotationViewWithIdentifier

这是我的代码:-(MKAnnotationView*)mapView:(MKMapView*)aMapViewviewForAnnotation:(id)annotation{if([annotationclass]==MKUserLocation.class){returnnil;}staticNSString*identifier=@"an";MKAnnotationView*pinView=nil;pinView=(MKAnnotationView*)[mapViewdequeueReusableAnnotationViewWithIdentifier:identifier];i

ios - Swift 中的 dequeueReusableAnnotationViewWithIdentifier

我有以下代码,用于尝试使注释View出队,然后在它不存在时创建一个,但是有一些重复,这看起来不像是“快速”的方式。关于如何改进这一点有什么建议吗?funcmapView(mapView:MKMapView!,viewForAnnotationannotation:MKAnnotation!)->MKAnnotationView!{letidentifier="annotation"ifletannotationView=mapView.dequeueReusableAnnotationViewWithIdentifier(identifier)as?MKPinAnnotationVie