如何在iPhone的MKMapView中显示带圆点的蓝色别针 [英] How to show blue pin with dot (circle) in MKMapView in IPhone

查看:142
本文介绍了如何在iPhone的MKMapView中显示带圆点的蓝色别针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题似乎有点复杂,但让我澄清一下.我正在使用mkmapview,在此我想用蓝色圆点和圆圈显示当前用户位置,但这并不是我想要的.当我制作iPhone应用程序时,由于我是新来映射集成的人,所以我很难做到这一点.如果任何人都可以为我提供其演示的链接,或者可以向我解释如何用带圆圈的蓝点显示用户位置在地图上,那对我会有很大的帮助.预先感谢

my question may seem a bit complicated but let me clarify. i am using mkmapview , in this i want to show current user location with blue dot and circle , but this isn't really exactly what I wanted. As I am making an iPhone application,SInce I am new to map integration its getting difficult for me to do the same.IF any one can provide me a link for its demo or can explain me how to show user location with blue dot with circle on map then it would be of great help to me . Thanks in advance

推荐答案

这是MKMapView类的属性之一.默认值为否",因此只需在代码中将其设置为是"即可.

This is one of properties of MKMapView class. Default value is No, so just set it to YES in your code.

请注意,如果将StoryView上的MapView添加到ViewController上,请查看属性检查器,默认情况下,除了用户位置之外,MapView上还检查了其他注解(建筑物,景点).我花了一段时间才找到它,感觉就像我在玩捉迷藏的游戏,不确定为什么取消选中它如此重要.

Note that if you add a MapView on to your ViewController in Storyboard, look at the attribute inspector, by default has other annotations checked (Buildings, Points of Interest) on your MapView excepts User Location. It took me a while to find this, it feels like I am playing hide and seek, no sure why it so important to leave this unchecked.

self.mapView.showsUserLocation = YES;

thexande 所述,对于swift3,您必须将其设置为true:

As thexande mentioned, for swift3 you will have to set this to true:

self.mapView.showsUserLocation = true;

这篇关于如何在iPhone的MKMapView中显示带圆点的蓝色别针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆