Question

This is my code to recenter map to user's location in iOS. This method works fine, but the problem I am having is dropping a placemark on the user's current location. I am new to using placemark and will appreciate it if someone help me out.

- (IBAction)recenterMapToUserLocation:(id)sender {
MKCoordinateRegion region;
MKCoordinateSpan span;

span.latitudeDelta = 0.02;
span.longitudeDelta = 0.02;

region.span = span;
region.center = self.mapView.userLocation.coordinate;

[self.mapView setRegion:region animated:YES];
}
Was it helpful?

Solution

To drop a pin on the user's location, all you have to do is tell the mapView to show the user's location:

[self.mapView setShowsUserLocation:YES];

That should do it!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top