gpt4 book ai didi

ios - 用户定位引脚的自定义注释

转载 作者:行者123 更新时间:2023-11-29 00:17:23 25 4
gpt4 key购买 nike

似乎可以更改用户位置注释图像。也许有人可以看出我错在哪里,如果...

-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
NSString* AnnotationIdentifier = @"Annotation";
MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
[annoationView setImage:[UIImage imageNamed:@"melocation"] ];
return annoationView;
}
}

最佳答案

当注释无法出列时,您忘记了第一次初始化注释:

-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
static NSString* const kAnnotationIdentifier = @"Annotation";
MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:kAnnotationIdentifier];
if (!annoationView) {
annoationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:kAnnotationIdentifier];
}
[annoationView setImage:[UIImage imageNamed:@"melocation"] ];
return annoationView;
}
return nil;
}

关于ios - 用户定位引脚的自定义注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44987696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com