2012-12-05 4 views
0

안녕하세요. 내가 도움이 필요하면 도움이 필요해. 맵 버튼을 누르면 위도와 경도가있는 오브젝트가 CLLocation 속성을 통해로드됩니다. 일은 내가지도가로드 된 후에는 주석 영역을 가고 싶어, 지역/센터 사용자 위치 좌표 설정지도를 원하는 해달라고, 그래서 내가 이렇게 :MKMapView setRegion to Annotation

- (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 콘센트는 좌표가 괜찮아도 힘든 지역을 설정하지 않습니다. 그것은 그러나 내가 그것을 준 다른 범위를 받아 들일 수 있지만 여전히 사용자 영역에 잠겨 있습니다; 질문은 ... 왜? 이 중지 다만,이 메소드를 호출에 대한 CLLocationManager 클래스 업데이트 위치하여 MKMapView 그래서 여기에 업데이트 된 현재 위치마다 당신의지도보기

의 영역으로 설정되어 있기 때문에

답변

1

그것은 ... 일

[yourLocationManager stopUpdatingLocation]; 
시작시 loadActiveEstateAnnotation 메소드의

메소드.