如何跟踪用户的位置并显示使用MapBox iOS sdk行进的路径

时间:2014-10-13 14:59:46

标签: ios iphone map mapbox

如何使用RMShape显示路径?

我想做现场跟踪和绘制旅行线。

- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(KRRMAnnotation *)annotation
{
    if (annotation.isUserLocationAnnotation)
        return nil;

    KRCalloutView *calloutView = [[[UINib nibWithNibName:@"KRRMCalloutView" bundle:nil] instantiateWithOwner:self options:nil] lastObject];
    calloutView.maxTitleLabelWidth = 250.0f;
    [calloutView setTitle:annotation.placeModel.title withAttributes:[KRStyleUtilities mapViewCalloutTextAttributes]];

    KRRMMarker *marker = [[KRRMMarker alloc]initWithUIImage:annotation.placeModel.pinImage andContentView:calloutView inMapView:mapView];
    marker.delegate = self.markerDelegateHandler;
    marker.cornerRadius = 10.0f;
    marker.correctCalloutPositionEnabled = YES;
    marker.canShowCallout = NO;

    return marker;
}

1 个答案:

答案 0 :(得分:1)

您可以删除并重新添加注释,强制重绘注释图层,也可以查看此修补程序,以便调用图层重绘:

https://github.com/tracyharton/mapbox-ios-sdk/commit/31cda12f5bcc04dad42db2e07558b95eb43604a7