我在这里尝试在MKMapView中显示乘数位,但未显示
import MapKit
@IBOutlet weak var mapView: MKMapView!
let locations = [
["title": "New York,NY","latitude": 40.713054,"longitude": -74.007228],["title": "Los Angeles,CA","latitude": 34.052238,"longitude": -118.243344],["title": "Chicago,IL","latitude": 41.883229,"longitude": -87.632398]
]
override func viewDidLoad()
{
for location in locations {
let annotation = MKPointAnnotation()
annotation.title = location["title"] as? String
annotation.coordinate = CLLocationCoordinate2D(latitude: location["latitude"] as! Double,longitude: location["longitude"] as! Double)
mapView.addAnnotation(annotation)
}
}
我的地图正在显示默认的印度地图。