Dave Cole Dave Cole - 2 months ago 11x
iOS Question

Google Maps for iOS - How can you tell if a marker is within the bounds of the screen?

I'm trying to figure out a straightforward way to determine in Google Maps for iOS if a given GMSMarker is within the bounds of the visible map. There seems to be solutions for this in the Javascript API but other than perhaps doing some complex reasoning based on this post there doesn't seem to be a way.


Retrieve the bounds of your viewport with GMSVisibleRegion and create a GMSCoordinateBounds with it. Call containsCoordinate, passing in the marker's position. It should return true if the marker is within the viewport and false if not.