我正在使用此代码绘制一组线:
CLLocationCoordinate2D points[[routes count]];
for(int i = 0; i < self.routes.count; i++)
{
CLLocation* location = [self.routes objectAtIndex:i];
points[i] = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate
.longitude);
}
self.routeLine = [MKPolyline polylineWithCoordinates: points count: [routes count]];
[self.mapView setVisibleMapRect: [self.routeLine boundingMapRect] animated: YES];
[self.mapView addOverlay:self.routeLine];
它适用于来自的一组行NSArray *routes
,但现在我需要不止一组行,例如NSMutableArray *routes = { NSArray with routes , NSArray with other group like first example , another array }
可能是这样的:
int sumaCount = [a1 count] + [a2 count] + [a3 count];
CLLocationCoordinate2D puntitos[sumaCount];
int c = 0;
for (NSArray *array in rutas)
{
for (CLLocation *cada in array)
{
puntitos[c] = CLLocationCoordinate2DMake(cada.coordinate.latitude, cada.coordinate.longitude);
c++;
}
self.routeLine = [MKPolyline polylineWithCoordinates: puntitos count: sumaCount];
[self.mapView addOverlay: self.routeLine];
}
但我得到了这个例外:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '***
-[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'