I'm using SampleMap example to draw path between 2 points and than move maps from start to end. When map moves, part of path that was out of visible area , becomes invisible until user drag map with finger. Anyone have similar problem? any suggestions to fix that? Here is code I'm using to draw path and move map:
//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 *startIm开发者_运维技巧age = [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;
As workaround Im calling moveBy on each moveToLatLong .
[mapView moveToLatLong:slideLocation];
[mapView moveBy:CGSizeMake(0,0)];
it works but Im not sure if its correct way to avoid this bug.
精彩评论