Display spiderfy leaflet annotation MKMapView

眉间皱痕 提交于 2019-12-06 16:28:09

问题


I want to show 100 map points using MKMapView on same lat longs. Please see the link.

Same thing i want in iphone.


回答1:


If you want to use 100's of annotation then below is the tutorial which will help you.

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

In this tutorial if you check the below method it will resolve your issue.

(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];
}
}


来源:https://stackoverflow.com/questions/23541930/display-spiderfy-leaflet-annotation-mkmapview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!