ios - Stop MKMapView from moving to user's current location when user moves the map -


i making app show places near user's current location. when user moves map, map moves user current location, on , on again. so, user can't see annotations on map, because if moves map, map goes current location.

this doing right now:

- (void)mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)userlocation { if (userlocation) {     mkcoordinateregion region = mkcoordinateregionmakewithdistance(userlocation.coordinate, 1000, 1000);     mkcoordinateregion regiondelmapa = [self.mapa regionthatfits:region];     if(isnan(regiondelmapa.center.latitude))     {         nslog(@"bad region...");     }else     {         [self.mapa setregion:regiondelmapa animated:yes];     } }    } 

i have tried other answers here, nothing happens. not desired behavior, how can stop updating user's current location?

[self.mapa setregion:regiondelmapa animated:yes]; 

that line sets map region. you're executing code every time update, reseting area map covers. if don't want map re-center on user's location @ each update, remove code -mapview:didupdateuserlocation: method.

if want center map on user once , allow user scroll away location, use core location user's location.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -