Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS how to keep current location center all the time

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

I searched a lot but couldn't find the way...

like image 547
MomentH Avatar asked Sep 18 '11 12:09

MomentH


1 Answers

In your map view delegate, do this:

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    [mapView setCenterCoordinate:userLocation.location.coordinate animated:YES];
}
like image 187
Daniel Dickison Avatar answered Sep 30 '22 04:09

Daniel Dickison