Iphone Route Me框架:如果以编程方式移动地图,RMPath将不可见

Iphone Route Me框架:如果以编程方式移动地图,RMPath将不可见,iphone,Iphone,我使用SampleMap示例在两点之间绘制路径,然后从起点到终点移动贴图。当地图移动时,超出可见区域的部分路径将不可见,直到用户用手指拖动地图。有人有类似的问题吗?有什么建议可以解决这个问题吗? 下面是我用来绘制路径和移动地图的代码: //Set map view center coordinate CLLocationCoordinate2D center; center.latitude = 47.582; center.longitude = -122.333; slideLocation

我使用SampleMap示例在两点之间绘制路径,然后从起点到终点移动贴图。当地图移动时,超出可见区域的部分路径将不可见,直到用户用手指拖动地图。有人有类似的问题吗?有什么建议可以解决这个问题吗? 下面是我用来绘制路径和移动地图的代码:

//Set map view center coordinate
CLLocationCoordinate2D center;
center.latitude = 47.582;
center.longitude = -122.333;
slideLocation = center;
[mapView.contents moveToLatLong:center];
[mapView.contents setZoom:17.0f];

// Add 2 markers(start/end)  and RMPath with 2 points
RMMarker *newMarker;
UIImage *startImage = [UIImage imageNamed:@"marker-blue.png"];
UIImage *finishImage = [UIImage imageNamed:@"marker-red.png"];
UIColor* routeColor = [[UIColor alloc] initWithRed:(27.0 /255) green:(88.0 /255) blue:(156.0 /255) alpha:0.75];
RMPath* routePath = [[RMPath alloc] initWithContents:mapView.contents];
[routePath setLineColor:routeColor];
[routePath setFillColor:routeColor];
[routePath setLineWidth:10.0f];
[routePath setDrawingMode:kCGPathStroke];
CLLocationCoordinate2D newLocation;
newLocation.latitude = 47.580;
newLocation.longitude = -122.333;   
[routePath addLineToLatLong:newLocation];
newLocation.latitude = 47.599;
newLocation.longitude = -122.333;   
[routePath addLineToLatLong:newLocation];
[[mapView.contents overlay] addSublayer:routePath];

newLocation.latitude = 47.580;
newLocation.longitude = -122.333;   
newMarker = [[RMMarker alloc] initWithUIImage:startImage anchorPoint:CGPointMake(0.5, 1.0)];
[mapView.contents.markerManager addMarker:newMarker AtLatLong:newLocation];
[newMarker release];
newMarker = nil;

newLocation.latitude = 47.599;
newLocation.longitude = -122.333;   
newMarker = [[RMMarker alloc] initWithUIImage:finishImage anchorPoint:CGPointMake(0.5, 1.0)];
[mapView.contents.markerManager addMarker:newMarker AtLatLong:newLocation];
[newMarker release];
newMarker = nil;

作为解决方法,我将在每次移动时至少调用moveBy

[地图视图移动至地图:幻灯片位置]

[地图视图移动对象:CGSizeMake(0,0)]


它可以工作,但我不确定它是否能正确地避免这个错误

如何实现[routePath setDrawingMode:kCGPathStroke];