问题描述
简单问题
我正在开发适用于iOS的App,我为原生iOS嵌入了新的Google Map。
一切正常,除了一个问题,我找不到本地IOS / Objective-C的propper解决方案,无论是在这里还是谷歌(如果有一个请告诉我,抱歉让你烦恼)
I´m working on an App for iOS where I embedded the new Google Map for native iOS.Everything works fine except one problem where I can´t find a propper solution for native IOS/ Objective-C neither here nor at google (if there is one please show me and sorry for annoying you)
我想要的:
我希望用户点击打开信息窗口的标记。如果他点击或点击信息窗口,它应该打开一个新的UIView与更多信息。
What I want:I want the User to Click on the Marker that opens the Info Window. After If he clicks or taps on the Info Window it should open a New UIView with further Informations.
我该怎么做?
感谢您的建议
推荐答案
1.conform to the GMSMapViewDelegate
protocol。
1.conform to the GMSMapViewDelegate
protocol.
@interface YourViewController () <GMSMapViewDelegate>
// your properties
@end
2.set your mapView _
委托。
2.set your mapView_
delegate.
mapView_.delegate = self;
3.实现 GMSMapViewDelegate
方法
- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker {
// your code
}
btw, marker.userData
很有用。您可以将所需数据设置到其中并在中使用 - mapView:didTapInfoWindowOfMarker:
btw, marker.userData
is useful. you can set your needed data into it and use it in - mapView:didTapInfoWindowOfMarker:
这篇关于在Google Maps SDK中的InfoWindow / Marker上添加Click事件,以获取原生iOS /目标C.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!