objective c - iOS MKMapView - stop map view from re-centering to the user's location if the user has panned/dragged the map view -


i have mkmapview in have set:

[self.mapview setshowsuserlocation:yes]; 

i want show user's location, , update location if he/she moves. when didupdateuserlocation gets called seems map re-centers user's location, if user have panned app see region. want able track user's position, let user explore map. didupdateuserlocation looks this:

- (void)mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)userlocation {      _currentlocation = userlocation;      [self.mapview setregion:mkcoordinateregionmake(cllocationcoordinate2dmake(self.currentlocation.coordinate.latitude + 0.0015, self.currentlocation.coordinate.longitude), mkcoordinatespanmake(0.01, 0.01)) animated:no];      [...] } 

any ideas on should achieve want?

as long set showsuserlocation property of mkmapview yes, user location automatically updated (cf apple docs).

you should remove "setregion" line, because line centers view on user location.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -