- (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];
}
所以底线mapview outlet aint设置区域甚至很难坐标很好。然而,它接受我给它的不同跨度,但它仍然始终锁定在用户区域;问题是......为什么?
答案 0 :(得分:1)
它的发生是因为您的CLLocationManager
类每次都使用MKMapView
更新位置,所以此处您更新的当前位置设置为MapView的区域
要停止此操作,只需调用此方法..
[yourLocationManager stopUpdatingLocation];
在<{1}}方法中开始。