我有两个包含纬度和经度的 csv 文件。我想在 iOS 6 地图上绘制两条折线或路线。我怎样才能做到这一点??
我试过下面的代码来绘制单条折线。
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"route" ofType:@"csv"];
NSString* fileContents = [NSString stringWithContentsOfFile:filePath];
NSArray* pointStrings = [fileContents componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSMutableArray* points = [[NSMutableArray alloc] initWithCapacity:pointStrings.count];
for(int idx = 0; idx < pointStrings.count; idx++)
{
    // break the string down even further to latitude and longitude fields.
    NSString* currentPointString = [pointStrings objectAtIndex:idx];
    NSArray* latLonArr = [currentPointString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]];
    CLLocationDegrees latitude  = [[latLonArr objectAtIndex:0] doubleValue];
    CLLocationDegrees longitude = [[latLonArr objectAtIndex:1] doubleValue];
    CLLocation* currentLocation = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
    [points addObject:currentLocation];
}
// create our route layer view, and initialize it with the map on which it will be rendered.
_routeView = [[CSMapRouteLayerView alloc] initWithRoute:points mapView:mapView];
但这段代码的问题是我无法滚动地图,双击放大也不起作用(基本上地图冻结)。虽然它在 Xcode 4.3(使用谷歌地图)中运行良好。