Add an NMAMapOverlay to the Map

落花浮王杯 提交于 2019-12-11 21:29:09

问题


This question was answered saying that NMAMapOverlay is the thing to use for a callout when a user taps a marker.

The SDK documentations says

The NMAMapOverlay class represents a special type of map object that does not inherit from the NMAMapObject base class. Instead, it inherits from the UIView class of Apple’s UIKit framework.

Since it is a UIView, you cannot call the addMapObject of NMAMapView.

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.

So my question is, how do you add an NMAMapOverlay to the Map?


回答1:


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


来源:https://stackoverflow.com/questions/33003683/add-an-nmamapoverlay-to-the-map

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!