저는 MapView가 있으며 사용자의 위치와 주변에는 관광 명소와 관련된 다양한 유형의 annotationView가 있습니다. MapView가 스크롤 할 수 있고 확대/축소되어 도시의 모든 annotationView를 보길 원하지만, MapView를 움직이면 즉각적인 중심의 촬영을 반환합니다. MKMapView는 스크롤하지 않고 확대/축소하지 않습니다.
이
은 MapViewController.m- (void)viewDidLoad{
//.....
self.mapView.zoomEnabled=YES;
self.mapView.scrollEnabled = YES;
//......
}
- (void) locationManager:(CLLocationManager *) manager
didUpdateToLocation:(CLLocation *) newLocation
fromLocation:(CLLocation *) oldLocation {
//......
self.coordinate = CLLocationCoordinate2DMake(self.latitudine, self.longitudine);
CLLocationCoordinate2D min = CLLocationCoordinate2DMake(self.coordinate.latitude -0.005,
self.coordinate.longitude-0.005);
CLLocationCoordinate2D max = CLLocationCoordinate2DMake(self.coordinate.latitude+0.005,
self.coordinate.longitude+0.005);
CLLocationCoordinate2D center = CLLocationCoordinate2DMake((max.latitude + min.latitude)
/2.0, (max.longitude + min.longitude)/2.0);
MKCoordinateSpan span = MKCoordinateSpanMake(max.latitude - min.latitude, max.longitude -
min.longitude);
MKCoordinateRegion region = MKCoordinateRegionMake(center, span);
self.mapView.region= region;
[mapView setRegion:region animated:TRUE];
//......
}
나는 이것이 문제라고 생각하지 않지만 [mapView setRegion : region animated : TRUE]; 잘못되었습니다. [mapView setRegion : region animated : YES]; – jcesarmobile
@jcesar TRUE 또는 YES를 전달할 때 차이점이 없습니다. 그들이 동일하기 때문에 그것은 전혀 중요하지 않습니다. –
@ConicaDegenere touchesBegan/end 메서드에서 무언가를하고 있는지 확인하십시오. –