我正在使用自定义的Callout(标题和副标题)来显示当前位置图标。我尝试了以下方法来禁用默认注释,但没有起作用。
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
NSLog(@"viewForAnnotation");
if ([annotation isKindOfClass:[MKUserLocation class]])
{
MKAnnotationView *userLocationView = [mapView viewForAnnotation:annotation];
userLocationView.canShowCallout = NO;
NSLog(@"[annotation isKindOfClass:[MKUserLocation class]");
return nil;
}
}
它只能以这种方式工作
-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)ann
{
if([ann.annotation isKindOfClass:[MKUserLocation class]] )
{
[mymap deselectAnnotation:ann.annotation animated:NO];
}
}
有时候会卡顿,是否有其他方法可以禁用当前位置标注的默认呼出视图?任何帮助将不胜感激。