您好,感谢您的帮助。
是否可以使用 for 循环从 .plist 文件中填充 10 个地图视图位置?如果有怎么办?
我当前的地图视图代码都是硬编码的。如果可能的话,我想通过从 for 循环中提取经度、纬度、标题、子标题来改进这一点。谢谢你。
////
.....
MKCoordinateRegion region3 = {{0.0,0.0}, {0.0,0.0}};
region3.center.latitude = 33.45869;
region3.center.longitude = -84.66931;
region3.span.longitudeDelta = 0.01f;
region3.span.latitudeDelta=0.01f;
// [mapview setRegion:region4 animated:YES];
BandsMap *ann3 = [[BandsMap alloc]init];
ann3.title = @"Indigo Bar & Lounge";
ann3.subtitle = @"Let the good times roll";
ann3.coordinate = region3.center;//
////
annoArray = [[NSArray alloc] initWithObjects:ann1,ann2,ann3.....,nil];
[mapView addAnnotations:annoArray];.......
我想是这样的,但不太确定如何完成
for(NSDictionary *key in mapDataPlist)
{
NSString *c = [key objectForKey:@"Title"];
NSString *a = [key objectForKey:@"SubTitle"];
NSString *lat = [key objectForKey:@"Latitude"];
NSString *lon = [key objectForKey:@"Longitude"];
CGFloat strFLat = (CGFloat)[lat floatValue];
CGFloat strFLon = (CGFloat)[lon floatValue];
//////
?????
}