我试图以这种方式在许多 MKMapViews 中找到注释的坐标:
NSMutableArray *latitudes = [NSMutableArray array];
for (MKMapView *map in MapViewArray)
{
NSString *latitude = [NSString stringWithFormat:@"%.2f", [map.annotations lastObject].coordinate.latitude];
[latitudes addObject: latitude];
}
NSMutableArray *longitudes = [NSMutableArray array];
for (MKMapView *map in MapViewArray)
{
NSString *longitude = [NSString stringWithFormat:@"%.2f", [map.annotations lastObject].coordinate.latitude];
[longitudes addObject: longitude];
}
这段代码虽然给了我这个错误:
property 'coordinate' not found on object of type id
我该如何解决?
数组中的地图视图属于这种类型:
@property (nonatomic, retain) IBOutlet MKMapView *mapView2;