2014-09-01 77 views
2

是一個新的IOS開發人員,我真的很努力想要一些基本的工作。IOS谷歌地圖sdk中的自定義信息窗口

我有一個需要顯示這種自定義信息窗口上的標記點擊谷歌地圖sdk爲ios。

enter image description here

任何幫助,將不勝感激。

我已經看到了第三方組件,但即使對他們我也無法得到這個顯示。總是有一個標題,片段,左側圖像和右側圖像部分。真正的問題是,你如何在窗口中獲得黃金星級,並在旁邊顯示文本。

+0

找到PLZ檢查這些鏈接,它可能會hep您https://github.com/grgcombs/MultiRowCalloutAnnotationView或https:// github.com/jpsim/JPSThumbnailAnnotation – sbrsantanu 2014-09-01 06:37:46

+0

我見過這些鏈接之前,他們是爲mapkit,這裏的關鍵是使用谷歌地圖 – gerhard 2014-09-01 07:09:03

+0

http://kevinxh.github.io/swift/custom-and-interactive-googlemaps-ios -sdk-infowindow.html這個博客解釋瞭如何解決這個問題。 – 2016-11-12 02:10:44

回答

2

讓廈門國際銀行,只要你想...設置文本和圖像

組委託GMSMapViewDelegate

-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker{ 

    CustomInfoWindow *infoWindow=[[[NSBundle mainBundle] loadNibNamed:@"InfoWindow" owner:self options:nil] objectAtIndex:0]; 
    return infoWindow; 

} 

https://www.youtube.com/watch?v=ILiBXYscsyY 更多的幫助 看到這個由谷歌

4

我忍受了GoogleMapsSdk for iOS中信息窗口定製的問題很多天,感到沮喪&做了我的自我!

乾淨,用您的自定義操作代碼完全可定製&自己UIControls可以在Github上Right here

編碼愉快:)

+0

僅供參考,信息窗口支持的實時渲染已添加到Google Maps SDK for iOS V 2+(從此版本開始)。 – 2016-10-19 16:51:20

0

雨燕3.0解決方案

谷歌地圖CustomInfoWindow

//empty the default infowindow 
    func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? { 
     return UIView() 
    } 

    // reset custom infowindow whenever marker is tapped 
    func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool { 

     customInfoView.removeFromSuperview() 
    // customInfoView.button.addTarget(self, action: #selector(buttonTapped(_:)), for: .touchUpInside) 
     self.view.addSubview(customInfoView) 

     // Remember to return false 
     // so marker event is still handled by delegate 
     return false 
    } 

    // let the custom infowindow follows the camera 
    func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) { 
     if (locationMarker != nil){ 
      let location = locationMarker.position 
      customInfoView.center = mapView.projection.point(for: location) 
     } 
    } 

    // take care of the close event 
    func mapView(_ mapView: GMSMapView, didTapAt coordinate: CLLocationCoordinate2D) { 
     customInfoView.removeFromSuperview() 
    } 
+0

我從這個鏈接得到了想法 http://kevinxh.github.io/swift/custom-and-interactive-googlemaps-ios-sdk-infowindow.html – 2016-11-18 15:36:29

相關問題