IOS how to constantly maintain the current location center

My map shows the current location with a blue dot. Of course, when I move, the blue dot moves. I just want to keep the blue center of the map point all the time, making the map move like a Google map navigator.

I searched a lot, but could not find a way ...

+5
source share
3 answers

In your case, the delegate on the map do the following:

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    [mapView setCenterCoordinate:userLocation.location.coordinate animated:YES];
}
+7
source

Try using it mapView.userTrackingMode = MKUserTrackingModeFollow;, you will get a smoother pan than manually.

, , : MKUserTrackingBarButtonItem.

+1

The easiest way is to create a new UIView on top of your map view with a blue dot and only move the map view.

-1
source

All Articles