问题描述
得到回答,说当用户点击标记时,NMAMapOverlay是用于标注的东西.
This question was answered saying that NMAMapOverlay is the thing to use for a callout when a user taps a marker.
SDK文档说
因为它是UIView,所以不能调用NMAMapView
的addMapObject
.
Since it is a UIView, you cannot call the addMapObject
of NMAMapView
.
我在文档中找不到如何向地图添加NMAMapOverlay的地方. SDKDemo应用程序中也不会使用NMAMapOverlay.
I cannot find anywhere in the documentation where it says how to add an NMAMapOverlay to the map. Nor is NMAMapOverlay used in the SDKDemo app.
所以我的问题是,如何将NMAMapOverlay添加到地图?
So my question is, how do you add an NMAMapOverlay to the Map?
推荐答案
使用以下代码,根据需要修改annotView.确保您已启用高级计划.它不适用于基本计划.
Use following code, Modify annotView as per your requirement. Make sure that you have premium plan enabled. It will not work with basic plan.
UIView *annotView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 20)];
annotView.backgroundColor = [UIColor redColor];
NMAMapOverlay *overlay = [[NMAMapOverlay alloc] initWithSubview:annotView];
overlay.coordinates = //your location's NMAGeoCoordinates
[self.mapView addMapOverlay:overlay];
这篇关于将NMAMapOverlay添加到地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!