2014-05-08 88 views
-3

enter image description here我想在同樣的經度長度上使用MKMapView顯示100個地圖點。請參閱link顯示spiderfy傳單註釋MKMapView

同樣的事情,我想在iphone。

+0

請檢查這個鏈接,我想顯示使用spiderfy leafleft動畫。 http://www.yourmapper.com/demo/spiderfy.htm。當我使用正常的過程時,地圖點彼此重疊,無法點擊特定的地圖點。所以通過使用蜘蛛動畫我們可以實現這一點。任何想法。 – Kittu

+0

最後,我通過使用Jquery + HTML找到了解決方案。 – Kittu

回答

0

如果你想使用100的註釋然後下面是教程,這將有助於你。

http://www.raywenderlich.com/21365/introduction-to-mapkit-in-ios-6-tutorial

如果您檢查下面的方法將解決您的問題本教程。

(void)plotCrimePositions:(NSData *)responseData { 

for (id<MKAnnotation> annotation in _mapView.annotations) { 
    [_mapView removeAnnotation:annotation]; 
} 

NSDictionary *root = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil]; 

NSArray *data = [root objectForKey:@"data"]; 

for (NSArray *row in data) { 

    NSNumber * latitude = [[row objectAtIndex:22]objectAtIndex:1]; 

    NSNumber * longitude = [[row objectAtIndex:22]objectAtIndex:2]; 

    NSString * crimeDescription = [row objectAtIndex:18]; 

    NSString * address = [row objectAtIndex:14]; 

    CLLocationCoordinate2D coordinate; 

    coordinate.latitude = latitude.doubleValue; 

    coordinate.longitude = longitude.doubleValue; 

    MyLocation *annotation = [[MyLocation alloc] initWithName:crimeDescription address:address coordinate:coordinate] ; 
    [_mapView addAnnotation:annotation]; 
} 
} 
+0

'[_mapView removeAnnotations:_mapview.annotations];'做你的第一個循環。 – Rayfleck

+0

請檢查這個鏈接中的蜘蛛動畫... http://www.yourmapper.com/demo/spiderfy.htm – Kittu

+0

當我使用正常的過程中,地圖點重疊在一起,無法點擊特定的地圖點。所以通過使用蜘蛛動畫我們可以實現這一點。任何想法。請檢查這個鏈接,我想顯示使用spiderfy leafleft動畫... http://www.yourmapper.com/demo/spiderfy.htm點擊地圖上的點將擴大。 – Kittu