문제

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];
}
도움이 되었습니까?

해결책

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top