【发布时间】:2017-08-11 10:27:42
【问题描述】:
我必须在我的地图视图中显示 5 个点(在数组中)。我已经在我的日志中显示了数组值。循环运行完美,没有添加注释。这是我的代码:
self.mapView.delegate = self
self.mapView.mapType = MKMapType.standard
self.mapView.isZoomEnabled = true
self.mapView.isScrollEnabled = true
self.mapView.showsUserLocation = true
print("LOCATION LIST==>>")
print(items["Location"].arrayValue)
for locationList in items["Location"].arrayValue
{
print(locationList)
let annotation = MKPointAnnotation()
annotation.coordinate = CLLocationCoordinate2D(latitude: locationList["latitude"].doubleValue, longitude: locationList["longitude"].doubleValue)
self.mapView.addAnnotation(annotation)
}
self.mapView.delegate = self
日志:
LOCATION LIST==>>
{
"Latitude" : 12.988415,
"Longtitude" : 80.218386
}, {
"Latitude" : 12.988445,
"Longtitude" : 80.21839199999999
}, {
"Latitude" : 12.988492,
"Longtitude" : 80.218422
}, {
"Latitude" : 12.988558,
"Longtitude" : 80.218461
},
{
"Latitude" : 12.991181,
"Longtitude" : 80.21950200000001
}
但它没有在我的地图视图中显示注释。提前致谢。
【问题讨论】:
标签: ios swift3 annotations mapkit