Anthony
Anthony

Reputation: 899

What does the 'shows user location' option of Map View do?

I have checked the 'Shows User Location' option of Map View in my storyboard. I am using the simulator and do not have access to a real device. When I run the code I can see the blue icon in my map defaulted to California as you expect.

I was wondering whether this blue icon updates on a real device? Does it move when the user is moving?

Or is there additional code that must be put in to make it work?

Upvotes: 0

Views: 531

Answers (1)

Gabriele Petronella
Gabriele Petronella

Reputation: 108159

The storyboard option correspond to the showsUserLocation property of MKMapView. From the documentation (emphasis added)

This property does not indicate whether the user’s position is actually visible on the map, only whether the map view should try to display it. Setting this property to YES causes the map view to use the Core Location framework to find the current location and try to display it on the map. As long as this property is YES, the map view continues to track the user’s location and update it periodically. The default value of this property is NO.

Of course, this assumes location services are on and the user granted the app the access to them.

Upvotes: 1

Related Questions