我想添加多个引脚在相同的位置。如何添加多个引脚在相同的纬度/长
for (int i = 0; i < [arrListing count]; i++) {
List *obj = [arrListing objectAtIndex:i];
NSLog(@"Title %@",obj.Title);
CLLocationCoordinate2D annotationCoord;
annotationCoord.latitude = [obj.lat floatValue];
annotationCoord.longitude = [obj.log floatValue];
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = annotationCoord;
annotationPoint.title = obj.Title;
[mapView addAnnotation:annotationPoint];
}
上面的代码代表加入mulitiple注释 但很多针在相同的位置
所以我只能看到。 最后一次,也是当时的第二次。下面 对于viewForAnnotation
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
MKPinAnnotationView *annView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"annView"];
if (!annView) {
annView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annView"];
annView.pinColor = MKPinAnnotationColorRed;
annView.animatesDrop = YES;
annView.canShowCallout = YES;
NSLog(@"iRow :%d",iRow);
annView.tag = iRow++;
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annView.rightCalloutAccessoryView = rightButton;
NSLog(@"if condition");
}
else
{
annView.annotation = annotation;
NSLog(@"else condition");
}
return annView;
}
有什么问题的代码?你什么都不问。 – rdurand
他还挺会......在“如何添加多个销” – mkral
同一纬度长,我想把50多针,但它显示了两个引脚只 –