【发布时间】:2017-07-18 15:22:16
【问题描述】:
我是谷歌地图的新手,我遵循以下教程https://developers.google.com/maps/documentation/ios-sdk/marker 当我尝试使用 for 循环显示多个注释时,我得到一个注释的输出。以下是我的代码,
for (int i = 0; i < [ARR count]; i++)
{
float latitude_val = [[NSString stringWithFormat:@"%@",[[ARR objectAtIndex:i] valueForKey:@"lat"]] floatValue];
float longitude_val = [[NSString stringWithFormat:@"%@",[[ARR:i] valueForKey:@"lng"]] floatValue];
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(latitude_val, longitude_val);
marker.map = _mapView;
}
谢谢
【问题讨论】:
-
以下几行是否是强制性的 [mkr setTitle:
]; [mkr setSnippet: ]; .如果是这样,我的噘嘴会显示一个注释 -
@Lalitkumar 我尝试将 float 更改为 double 但仍显示单个注释
-
@Jayasabeen 你能打印
ARRlat & lng 值的值,并在你的问题中添加这些 lat,lng 值吗?
标签: ios objective-c google-maps