MKMapview place pin at location (long/lat)

后端 未结 6 1686
说谎
说谎 2021-02-01 06:31

I have latitude and long values and I need to be able to drop a pin at this location.

Can anybody provide some advice on how to go about this?

6条回答
  •  隐瞒了意图╮
    2021-02-01 07:18

    Swift Version

            let location = CLLocationCoordinate2DMake(13.724362, 100.515342);
            let region = MKCoordinateRegionMakeWithDistance(location, 500.0, 700.0)
            self.mkMapView.setRegion(region, animated: true)
            // Drop a pin
            let dropPin = MKPointAnnotation();
            dropPin.coordinate = location;
            dropPin.title = "Le Normandie Restaurant";
            self.mkMapView.addAnnotation(dropPin);
    

提交回复
热议问题