I tried to add a polyline to my existing MapView. Multiple iOS tutorials show how it works with an implementation of mapView:viewForOverlay: and with an MKOverlayView as return type. What return type should be used for OS X development, because in the MapKit framework reference I find no MKOverlayView ...
Any suggestions?
There correct class you need to use in OSX is MKPolylineRenderer
-(MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay{
MKPolylineRenderer *polylineView = [[MKPolylineRenderer alloc] initWithPolyline:overlay];
polylineView.strokeColor = [NSColor blueColor];
polylineView.lineWidth = 3.0;
return polylineView;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.