2017-06-16 5 views
-4

=ピン は私を助けてください{スウィフト}ピンをリンクさせますか?私は私のletのリンク方法が見つからない

私の最初のコード:

@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ピンの第1コード=第2コード

ありがとう

+0

あなたの 'MKPinAnnotationView'クラスをどのようにインスタンス化するか尋ねていますか? –

答えて

0
let pin = MKPinAnnotationView(title: "title", subtitle: "subtitle", coordinate: CLLocationCoordinate2DMake(27.33, 85.03)) 
関連する問題