Reputation: 102
I customized a infoWindow, but this shows a infowindow default in the background. Is there a way to hide the infoWindow background? or that I'm doing wrong.
The code is:
func mapView(mapView: GMSMapView!, markerInfoContents marker: GMSMarker!) -> UIView! {
if let infoView = UIView.viewFromNibName("MarkerInfoView") as? MarkerInfoView {
infoView.lblTitle.text = "Title" //marker.title
infoView.lblDescription.text = "Description"
infoView.lblDescription.numberOfLines = 0
infoView.lblDescription.lineBreakMode = NSLineBreakMode.ByWordWrapping
infoView.lblDescription.sizeToFit()
return infoView
} else {
return nil
}
}
Upvotes: 0
Views: 3469
Reputation: 444
If you are using a customInfoWindow
, then you don't have to access GMSMarker()
properties like marker.snippet
and marker.title
Even if you use them by mistake in your code, then you need to return an empty view in delegate method:
func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
return UIView()
}
Upvotes: 0
Reputation: 29
in your nib file, where you do custom look for your info window, set top nib view background color to clear color
Upvotes: 1
Reputation: 121
make sure that you don't have
marker.title = "something"
anywhere in your code. Then the default will always show unless you use
func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
<#code#>
}
to set your infoWindow properties.
Upvotes: 0
Reputation: 1931
I think you need to implement this method and return your custom view.
func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView?
Upvotes: 0
Reputation: 24341
Set your custom view as the marker image instead of the info window.
Convert your custom view into image and set it as marker image.
That will solve your purpose.
Upvotes: 0