2
在iOS中,一次只能显示一个MKPointAnnotation的标注。我希望能够一次性在屏幕上显示所有引脚的标注。任何建议,将不胜感激。如何在MKMapView中一次显示多个MKPointAnnotation的标注?
在iOS中,一次只能显示一个MKPointAnnotation的标注。我希望能够一次性在屏幕上显示所有引脚的标注。任何建议,将不胜感激。如何在MKMapView中一次显示多个MKPointAnnotation的标注?
你尝试的MKMapView类的这个方法:
- (void)addAnnotations:(NSArray *)annotations;
您应该将所有MKAnnotation对象添加到一个数组中,并调用类的方法与阵列。
例子:
NSMutableArray *filterLocs=[NSMutableArray array];
for (MKAnnotation *loc in YourMapPointsArray)
{
//add some condition here to manipulate your map points
[filterLocs addObject:loc];
}
[self.mapView addAnnotations:filterLocs];
或只是让普通
[self.mapView addAnnotations:YourMapPointsArray];
是的,这很容易实现。我试图一次性显示注释的所有“标注”。 [eventMap selectAnnotation:point animated:YES]; - 所有注释。问题是苹果只允许你一次显示一个。 – user1530580
我在我的地图中执行此操作,并且所有注释都在某个时间出现BTW我不想要任何动画,因此该方法对我来说很好。 – satheeshwaran
你能举个例子吗?不遵守。 – user1530580