How to get iPhone Maps app blue dot with light blue field for current location?

空扰寡人 提交于 2020-01-14 09:45:09

问题


I think the title is quite self explanatory. Currently when I add a default annotation for current location:

let currentAnnot = MKPointAnnotation()
currentAnnot.coordinate = loc.coordinate
mainMap.addAnnotation(currentAnnot)

It is giving me a red pin. I want the same blue dot with light blue field which the Apple iPhone Maps app is using by default. Is there a special name for that and how can I add it?


回答1:


It's because you're adding an annotation (pin) rather than the user location.

Enable it by using the following

mapView.showsUserLocation = true

Also check out a tutorial which may help



来源:https://stackoverflow.com/questions/33224044/how-to-get-iphone-maps-app-blue-dot-with-light-blue-field-for-current-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!