gpt4 book ai didi

ios - 如何在MKMapView中一次显示多个MKPointAnnotation的标注?

转载 作者:行者123 更新时间:2023-12-01 17:09:21 31 4
gpt4 key购买 nike

在iOS中,一次只能显示一个MKPointAnnotation的标注。我希望能够一次在屏幕上显示所有图钉的标注。任何建议,将不胜感激。

最佳答案

您是否尝试过MKMapView类的此方法:

- (void)addAnnotations:(NSArray *)annotations;

您应该将所有MKAnnotation对象添加到数组,然后使用该数组调用class方法。

例:
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];

关于ios - 如何在MKMapView中一次显示多个MKPointAnnotation的标注?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16783773/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com