Tôi đang chú thích bản đồ của mình và đặt hình ảnh tốt, nhưng khi tôi nhấn vào chú thích trên MapView, hình ảnh sẽ chuyển từ hình ảnh tùy chỉnh của tôi trở lại ghim màu đỏ. Tại sao điều này?Tại sao hình ảnh chú thích MKMapView tùy chỉnh biến mất khi chạm?
- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id)newAnnotation {
MKPinAnnotationView *annotation = [[MKPinAnnotationView alloc] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];
if (annotation == nil) {
annotation = [[MKAnnotationView alloc] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];
}
annotation.image = [UIImage imageNamed:@"anno.png"];
annotation.canShowCallout = YES;
annotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bus_stop_30x30.png"]];
annotation.leftCalloutAccessoryView = imgView;
return annotation;
}
Mã của tôi trông giống hệt một số mã mẫu không tạo ra sự cố này.
nhờ cho điều này solution..saved thời gian của tôi .. –