hy guys. i need some help if u may. when im pressing the map button i load a object wich has longitude and latitude through a CLLocation property. thing is, i dont want the map to set the region/center coordinate to the user location, i want it to go the the annotation region after the map is loaded, so i do this:
- (void)loadActiveEstateAnnotation
{
RE_Annotation *re_annotation = [[RE_Annotation alloc] init];
if(self.mapView.showsUserLocation == YES)
NSLog(@"Santa Clause is comming to town");
re_annotation.longitude = viewingEstate.estateLocation.coordinate.longitude;
re_annotation.latitude = viewingEstate.estateLocation.coordinate.latitude;
re_annotation.poiID = [[RE_Shared sharedInstance] selectedEstate];
re_annotation.title = [NSString stringWithFormat:@"Estate %d",re_annotation.poiID];
[self.mapView addAnnotation:re_annotation];
CLLocationCoordinate2D activeAnnotationCoordonate;
activeAnnotationCoordonate.longitude = re_annotation.longitude;
activeAnnotationCoordonate.latitude = re_annotation.latitude;
MKCoordinateSpan activeEstateSpan;
activeEstateSpan.longitudeDelta = 0.05;
activeEstateSpan.latitudeDelta = 0.05;
MKCoordinateRegion activeEstateRegion;
activeEstateRegion.center = activeAnnotationCoordonate;
activeEstateRegion.span = activeEstateSpan;
NSLog(@"----These are the coordinates%f,%f", activeAnnotationCoordonate.longitude, activeAnnotationCoordonate.latitude); // coordinates are good and valid ive checked them
[self.mapView setRegion:activeEstateRegion];
[self.mapView regionThatFits:activeEstateRegion];
[re_annotation autorelease];
}
So bottom line mapview outlet aint setting the region even tough the coordinates are fine. it does however accept the different spans i gave it but its still always locked on the user region ; question is …why?
Its happen because your
CLLocationManagerclass Update Location every time with yourMKMapViewso here your updated current location are set as region of your MapViewFor stop this ,just call this method..
in your
loadActiveEstateAnnotationmethod at starting.