user1810991 user1810991 - 15 days ago 6
Objective-C Question

How can i add a button to google maps marker info window on ios?

I have added Google maps sdk for ios to my Iphone app, and i have some custom markers if clicked info window pops up with title, how can i add a button to this info window so if pressed will go to new page? Now i have tryed to use this post to solve this issue Adding Click Event on InfoWindow/Marker in Google Maps SDK for native iOS/objective C it doesnt give me error but it won't work.

this is what i want my result to be:http://www.flickr.com/photos/74719051@N05/6728157477/

Answer

The answer for the question you linked shows code for using MapKit, so it wouldn't work with the Google Maps SDK for iOS.

See this question for how to return a custom view with the Google Maps SDK for iOS:

Custom annotation view in Google Maps SDK

However note that according to this question, it looks like what is displayed might be a visual copy of the view not the actual view, which might limit the interaction you can do with the view:

Add buttons to view returned by markerInfoWindow delegate method

Simply detecting a tap on the info window and going to a different page should be possible using didTapWindowOfMarker though.

Note that there's a feature request in Google's issue tracker to add direct support for this:

https://code.google.com/p/gmaps-api-issues/issues/detail?id=4961

Comments