仅从MKMapView中删除餐馆

Del*_*D0D 2 mkmapview mkannotation ios point-of-interest

我希望我MKMapView能展示餐馆以外的兴趣点.这是可能的,如果可以,我该如何设置?

我确实在文档中看到了以下内容,但它真的全有或全无?

@property (nonatomic) BOOL showsPointsOfInterest;
Run Code Online (Sandbox Code Playgroud)

当此属性设置为YES时,地图会显示餐馆,学校和其他相关兴趣点的图标和标签.此属性的默认值为YES.

例如,在下面,我想要加油站展示而不是餐厅.

在此输入图像描述

小智 6

使用 IOS 13,您可以选择过滤:这里是一个示例,在地图上不显示任何项目

localMap.pointOfInterestFilter = .some(MKPointOfInterestFilter(including: []))
Run Code Online (Sandbox Code Playgroud)

例如,您可以从地图中过滤机场...

localMap.pointOfInterestFilter = .some(MKPointOfInterestFilter(including: [MKPointOfInterestCategory.airport]))
Run Code Online (Sandbox Code Playgroud)


jsz*_*ski 5

无法控制绘制的特定点类型.Apple可以在Map Kit的任何未来更新中添加/删除/更改它显示的特定类型.正如您所提到的,您唯一的行动方案是设置showsPointsOfInterest.

您可以使用Foursquare或Facebook中的第三方场所数据库来获取类似的兴趣点并将其绘制在地图上,但无法保证结果与Apple原本显示的结果相符.