Reputation: 1303
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;
}
Upvotes: 1
Views: 5035
Reputation: 1950
The reason behind this white background is that you are using a wrong delegate method. Replace your code with this one:
-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(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;
}
Upvotes: 1
Reputation: 408
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
Upvotes: 4