Swift 3更新位置注释

时间:2016-12-23 12:31:19

标签: swift swift3 mapkit

Project Screen

例如,这个红针的协调现在是:51.507222,-0.1275。我想改变这个的cordendine。我怎么能这样做?

class Capital: NSObject, MKAnnotation {
    var title: String?
    var coordinate: CLLocationCoordinate2D
    var info: String

    init(title: String, coordinate: CLLocationCoordinate2D, info: String) {
        self.title = title
        self.coordinate = coordinate
        self.info = info
    }
}

let london = Capital(title: "London", coordinate: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), info: "Home to the 2012 Summer Olympics.")

@IBOutlet weak var mapView: MKMapView!


override func viewDidLoad() {
    super.viewDidLoad()

    mapView.addAnnotations([london])
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

0 个答案:

没有答案