Reputation: 31
I'm working on an iOS project which shows map with pinned locations. 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. Its like Google Maps is rendering the custom info window as an image.
Is there any way where i can have buttons inside of it and have Touch Up inside fired?
Upvotes: 3
Views: 4856
Reputation: 1303
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
for more info: 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/
Upvotes: 1
Reputation: 914
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.
https://developers.google.com/maps/documentation/ios/marker#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.
Upvotes: 0