[英]Google Maps SDK iOS - Custom marker info window with UIButton
I'm working on an iOS project which shows map with pinned locations. 我正在开发一个iOS项目,该项目显示带有固定位置的地图。 When user taps on a location an Custom Info window is shown with some details.
当用户点击位置时,会显示自定义信息窗口,其中包含一些详细信息。 I use the below method to
我用下面的方法来
- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker
The custom info window has a set of labels & buttons. 自定义信息窗口有一组标签和按钮。 As of now everything is working perfectly except that the IBOutlet of the UIButton in the custom info window is not firing.
截至目前,除了自定义信息窗口中的UIButton的IBOutlet未触发外,一切都运行良好。 Its like Google Maps is rendering the custom info window as an image.
就像Google Maps将自定义信息窗口渲染为图像一样。
Is there any way where i can have buttons inside of it and have Touch Up inside fired? 有什么方法我可以在里面有按钮,并在内部触摸Touch Up?
You cannot create an UIButton in a info window, it's a snapshot of the UIView, what you can do, is create an UItapGesture recognizer or use another delegade didTapInfoWindowOfMarker 您无法在信息窗口中创建UIButton,它是UIView的快照,您可以做的是创建UItapGesture识别器或使用其他委托didTapInfoWindowOfMarker
for more info: https://developers.google.com/maps/documentation/ios/reference/protocol_g_m_s_map_view_delegate-p#ae1614978aef680d671a6a95da8e13bf7 有关详情,请访问: https : //developers.google.com/maps/documentation/ios/reference/protocol_g_m_s_map_view_delegate-p#ae1614978aef680d671a6a95da8e13bf7
here's a free course: 这是一个免费的课程:
http://googlemaps.codeschool.com/ http://googlemaps.codeschool.com/
You're exactly right, the info window is rendered as a flattened view. 你说得对,信息窗口呈现为一个平面视图。
Please see the grey-boxed note on the developers page regarding Info Windows. 请参阅开发者页面上有关Info Windows的灰色框注释。
https://developers.google.com/maps/documentation/ios/marker#info_windows https://developers.google.com/maps/documentation/ios/marker#info_windows
https://developers.google.com/maps/documentation/android/infowindows#custom_info_windows https://developers.google.com/maps/documentation/android/infowindows#custom_info_windows
I've had this problem myself, there is no (sane) way around it. 我自己有这个问题,没有(理智的)方法。 Unfortunately, you'll have to redesign what you're trying to achieve.
不幸的是,你必须重新设计你想要实现的目标。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.