Search code examples
iosgoogle-mapsgoogle-maps-sdk-ios

Custom Google Maps Marker for iOS (GMSMarker)


I am trying to create an custom marker for Google Map, but my code is giving me a weird view with space, as the image bellow:

What is that white view? How to remove it? It was supposed to be only the red one!

-(UIView *)mapView:(GMSMapView *)mapView markerInfoContents:(GMSMarker *)marker{
    UIView *infoView = [UIView new];
    infoView.frame = CGRectMake(0, 0, 290, 192);
    // Setting the bg as red just to illustrate
    infoView.backgroundColor = [UIColor redColor];
    return infoView;
}

enter image description here


Solution

  • I might be a bit rusty but isn't that the wrong function?

    There is a markerInfoWindow and a markerInfoContents (which you are using). The window is the whole thing whereas the contents is a view, which will be placed within the default info window frame

    take a look here