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