2014-09-01 84 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

相关问题