Google Maps – Show all Info Windows

Google Maps for iOS can’t show all Info Windows (unlike the Android version). But there’s an easy way around this limitation. All you have to do is render your Info Window along with your pin icon as an image, and set that image as a pin icon. Google Maps will render your standard Info Window as an image anyway, but be careful when you render your own Info Windows, because there’s a limit on texture atlases in Google Maps (your app will crash if you reach the limit).

So what we want is to get from this:

google-maps1

To this:

google-maps2

Assuming you added the Google Maps iOS SDK, create a new nib file (.h and .m files too ๐Ÿ™‚ ) that you’ll be using as your custom Info Window. You can create a method similar to this one in the implementation file:

This method will take the marker object and the icon, and it will render the icon in the bottom center of the view. This way we’ll get the default Google Maps behavior.

Feel free to download the code from my GitHub repo, and play with it: DAMapAnnotation

Have a nice day ๐Ÿ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.