我很难找到如何为我的 CLLocationCoordinate2D 名称变量使用字符串。在我的代码中,我得到了 90 个位置:
CLLocationCoordinate2D location1;
...
CLLocationCoordinate2D location90;
我想调用这个方法:
locationConverToImage = [myMapView convertCoordinate:location1 toPointToView:drawView];
在这样的 for 循环中:
for (int i=1; i<=90; i++) {
NSString *newCoord = @"location";
[newCoord stringByAppendingString:[NSString stringWithFormat:@"%d",i]];
locationConverToImage = [myMapView convertCoordinate:newCoord toPointToView:drawView];
}
但问题是我不能使用字符串作为变量名。我能怎么做 ?
谢谢。