2016-08-03 76 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

对不起,我没有看到:\ –

相关问题