Google地图在标记信息窗口iOS中显示speechbubble [英] Google Maps Showing speechbubble in marker info window iOS

查看:223
本文介绍了Google地图在标记信息窗口iOS中显示speechbubble的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS应用程序中使用GoogleMaps SDK。我为GoogleMaps实现了自定义信息窗口,并将其视为我的ViewController,作为

  func mapView(mapView:GMSMapView !, markerInfoContents标记: GMSMarker!) - > UIView的! {
var calloutView:CalloutView = NSBundle.mainBundle()。loadNibNamed(CalloutView,owner:self,options:nil)[0] as! CalloutView
views!.detailDisclosure.addTarget(self,action:detailDisclosureButton_Clicked:,forControlEvents:UIControlEvents.TouchUpInside)
views.labelText.text =ABC Text
return views

}

获得如下输出



信息窗口重叠并显示如下底部边缘。信息窗口上的按钮也没有被点击。 $ c>有一些问题。就我而言,我最终使用了,markerInfoWindow呈现为图像,但不是真正的 UIView


注意:每次将信息窗口显示在地图上时,都会将信息窗口呈现为图像。这意味着任何对其属性进行更改时都不会立即可见。信息窗口的内容在下次显示时会刷新。


它不会收到任何UI事件。所以,可悲的是,markerInfoWindow上的任何 UIControl 都没用。唯一受支持的方式是使用 - mapView:didTapInfoWindowOfMarker: 代表方法,也就是说,不能在信息窗口中定义多个可点击区域。


I am using GoogleMaps SDK in my iOS application. I have implemented custom info window for GoogleMaps and calling it my ViewController as,

func mapView(mapView: GMSMapView!, markerInfoContents marker: GMSMarker!) -> UIView! {
    var calloutView:CalloutView = NSBundle.mainBundle().loadNibNamed("CalloutView", owner: self, options: nil)[0] as! CalloutView
    views!.detailDisclosure.addTarget(self, action: "detailDisclosureButton_Clicked:", forControlEvents: UIControlEvents.TouchUpInside)
    views.labelText.text = "ABC Text"
 return views

}

And getting output as below

Info window overlapping and showing bottom edges as below. Also button on info window not getting clicked. Please help for the same.

解决方案

With my experience, - mapView:markerInfoContents: have some problems. In my case, I ended up using - mapView:markerInfoWindow: instead. In this case, you have to draw balloon image by yourself, like this:

Also button on info window not getting clicked.

As documented on the bottom of this, markerInfoWindow is rendered as an image, but not true UIView.

Note: The info window is rendered as an image each time it is displayed on the map. This means that any changes to its properties while it is active will not be immediately visible. The contents of the info window will be refreshed the next time that it is displayed.

It does not receive any UI events. So, sad to say, any UIControls on markerInfoWindow is useless. The only supported way is to use - mapView:didTapInfoWindowOfMarker: delegate method, that means, you can not define multiple clickable areas on the info window.

这篇关于Google地图在标记信息窗口iOS中显示speechbubble的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆