1
當我在地圖上放多個針腳取決於不同的經度和緯度值。即時讓所有的針腳在地圖上的一個地方。當我在地圖中放置多個引腳取決於不同的經度和緯度值。即時讓所有的針腳只在一個地方
我寫了這個代碼來放置多個引腳。
dealerMapView.mapType = MKMapTypeStandard;
dealerMapView.zoomEnabled =YES;
[dealerMapView setDelegate:nil];
dealerMapView.scrollEnabled = YES;
dealerMapView.showsUserLocation = NO;
CLLocationCoordinate2D location;
for (int i =0; i<[delarsInfoArray count]; i++) {
NSString *lattitudeValue = [[delarsInfoArray objectAtIndex:i]objectForKey:@"LATITUDE" ];
NSString *longitudeValue = [[delarsInfoArray objectAtIndex:i]objectForKey:@"LONGITUDE" ];
CLLocationCoordinate2D pCoordinate ;
pCoordinate.latitude = [lattitudeValue floatValue];
pCoordinate.longitude = [longitudeValue floatValue];
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta = 0.005;
span.longitudeDelta = 0.005;
region.span = span;
region.center = location;
[dealerMapView setRegion:region animated:YES];
myAnnotation1 = [[MyAnnotation alloc] init];
myAnnotation1.coordinate = location;
myAnnotation1.title = [[delarsInfoArray objectAtIndex:i]objectForKey:@"STORE"];
[dealerMapView addAnnotation:myAnnotation1];
}
:謝謝..我的代碼現在在你的幫助下正常工作。 – Pavne 2013-02-15 09:12:43
歡迎您!您在循環的每次迭代中都設置了映射區域。這就是根據我導致你遇到的問題!我很高興它幫助你。 – 2013-02-15 09:32:18