sberley
sberley

Reputation: 2248

controlling a marker's info window

Does anyone have ideas of how to style the info window's text and background. They're the lollipops that show when you touch on a pin?

Also, I'm looking for a creative way to programmatically force the info window to display. Any suggestions?

Thanks...

p.s. Yay! It's here!

Upvotes: 2

Views: 3766

Answers (2)

sberley
sberley

Reputation: 2248

Google's documentation doesn't make the answer to this obvious so expanding on @s12chung's guidance above, here's how to make the info window visibly programatically (for anyone else who's trying to do this)

GMSMarkerOptions *pin = [[GMSMarkerOptions alloc] init];
self.mapView.selectedMarker = [self.mapView addMarkerWithOptions:pin];

Upvotes: 0

s12chung
s12chung

Reputation: 1768

GMSMapView.h's GMSMapViewDelegate:

/**
* Called when a marker is about to become selected, and provides an optional
* custom info window to use for that marker if this method returns a UIView.
* If you change this view after this method is called, those changes will not
* necessarily be reflected in the rendered version.
*
* The returned UIView must not have bounds greater than 500 points on either
* dimension.  As there is only one info window shown at any time, the returned
* view may be reused between other info windows.
*
* @return The custom info window for the specified marker, or nil for default
*/
- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(id<GMSMarker>)marker;

Upvotes: 1

Related Questions