问题
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