2016-08-03 74 views
1

我想創建一個Google地圖標記的信息窗口,以在我的iOS應用程序的信息窗口內提供按鈕點擊事件。有沒有辦法做到這一點?按鈕點擊地圖標記信息窗口內的事件

+0

我發現從2013年這段視頻,希望這可以幫助你:https://www.youtube.com/watch?v=ILiBXYscsyY –

+0

和計算器另一個話題: 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

對不起,我沒有看到:\ –

相關問題