How to show blue pin with dot (circle) in MKMapView in IPhone

后端 未结 4 2239
礼貌的吻别
礼貌的吻别 2020-12-31 21:04

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 rea

4条回答
  •  天涯浪人
    2020-12-31 22:02

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

    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;
    

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

    self.mapView.showsUserLocation = true;
    

提交回复
热议问题