{Swift}让pin链接?

时间:2017-06-16 18:19:15

标签: swift

我找不到链接我的let = pin 请帮帮我

我的第一个代码:

@IBOutlet weak var Point1S: MKMapView!

override func viewDidLoad() {
    super.viewDidLoad()

    let location = CLLocationCoordinate2DMake(43.429837, 5.434837)

   Point1S.setRegion(MKCoordinateRegionMakeWithDistance(location, 500, 500), animated: true)

    let pin = here
}

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

第二段代码:

import MapKit

class MKPinAnnotationView : NSObject , MKAnnotation {
    var title: String?
    var subtitle: String?
    var coordinate: CLLocationCoordinate2D

    init(title : String , subtitle : String , coordinate : CLLocationCoordinate2D) {

        self.title = title
        self.subtitle = subtitle
        self.coordinate = coordinate
    }

}

我不知道如何在let pin =第二个代码

中加入我的第一个代码

感谢

1 个答案:

答案 0 :(得分:0)

let pin = MKPinAnnotationView(title: "title", subtitle: "subtitle", coordinate: CLLocationCoordinate2DMake(27.33, 85.03))