2016-08-03 4 views
1

iOSアプリケーションの情報ウィンドウ内でボタンのクリックイベントを提供するGoogleマップマーカーの情報ウィンドウを作成します。これを行う方法はありますか?マップマーカー内のボタンクリックイベント

+0

を助けることができる私は、これはあなたを助けることを願って、2013年からこの動画を見つけました:https://www.youtube.com/watch?v=ILiBXYscsyY –

+0

とstackoverflowの上の別のトピック: http://stackoverflow.com/questions/16746765/custom-info-window-for-google-maps –

答えて

0

希望これはあなた

extension ViewController: MKMapViewDelegate { 
    func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { 
     if annotation is MKUserLocation { 
      return nil 
     } 
     let identifier = "MyCustomAnnotation" 

     var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(identifier) 
     if annotationView == nil { 
      annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier) 
      annotationView?.canShowCallout = true 
     } else { 
      annotationView!.annotation = annotation 
     } 

     let myButton = UIButton() 

     annotationView?.leftCalloutAccessoryView = myButton 

     return annotationView 
    } 

} 
+1

ありがとうございます。私はマップキットを使用していません。 – user3480213

+0

ああ申し訳ありませんが、私はそれを見ていない:\ –

関連する問題