Show Current Location and Update Location in MKMapView in Swift

前端 未结 10 1455
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 12:06

I am learning how to use the new Swift language (only Swift, no Objective-C). To do it, I want to do a simple view with a map (MKMapView). I want to find and up

10条回答
  •  时光取名叫无心
    2020-12-02 13:02

    Hi Sometimes setting the showsUserLocation in code doesn't work for some weird reason.

    So try a combination of the following.

    In viewDidLoad()

      self.mapView.showsUserLocation = true
    

    Go to your storyboard in Xcode, on the right panel's attribute inspector tick the User location check box, like in the attached image. run your app and you should be able to see the User location

提交回复
热议问题