具有自定义注释、标注和蓝色精度圆圈的当前位置
经过两个小时的谷歌搜索后,我找不到答案,所以这是我的最后一次尝试。
我想在 mkmapview 上为用户当前位置使用自定义注释。但我也想在它周围有蓝色的精度圆圈。
这可以做到吗?
如果没有,我可以向默认的带圆圈的蓝点添加标注吗?
我需要这个的原因是因为在我的应用程序上,当前位置点经常在其他注释下消失。这就是为什么我使用带有标注的紫色图钉作为当前位置。
这是我的注释代码:
if ([annotation isKindOfClass:MKUserLocation.class])
{
MKPinAnnotationView *userAnnotationView = (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:@"UserLocation"];
if (userAnnotationView == nil) {
userAnnotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"UserLocation"]autorelease];
}
else
userAnnotationView.annotation = annotation;
userAnnotationView.enabled = YES;
userAnnotationView.animatesDrop = NO;
userAnnotationView.pinColor = MKPinAnnotationColorPurple;
userAnnotationView.canShowCallout = YES;
[self performSelector:@selector(openCallout:) withObject:annotation afterDelay:0.01];
return userAnnotationView;
}
感谢您的任何建议。干杯,克里斯蒂安
After 2 hours of googling I couldn't find an answer so this is my last shot.
I would like to use a custom annotation for the user current location on a mkmapview. But I also want to have the blue accuracy circle around it.
Can this be done?
If not, can I add a call-out to the default blue dot with circle?
The reason that I need this is because on my app, the current location dot often disappears under other annotations. So that's why I use a purple pin with a call-out as current location.
Here is my code for the annotation:
if ([annotation isKindOfClass:MKUserLocation.class])
{
MKPinAnnotationView *userAnnotationView = (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:@"UserLocation"];
if (userAnnotationView == nil) {
userAnnotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"UserLocation"]autorelease];
}
else
userAnnotationView.annotation = annotation;
userAnnotationView.enabled = YES;
userAnnotationView.animatesDrop = NO;
userAnnotationView.pinColor = MKPinAnnotationColorPurple;
userAnnotationView.canShowCallout = YES;
[self performSelector:@selector(openCallout:) withObject:annotation afterDelay:0.01];
return userAnnotationView;
}
Thanks for any advise. Cheers, Christian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,所以我最终删除了自定义通知,但添加了自动弹出的调用。像这样:
和:
如果没有延迟,调出将不会显示。
OK, so I ended up deleting the custom notification but adding a call out that pops up automatically. Like this:
and:
Without the delay the call-out will not show up.