How to force refresh contents of the markerInfoWindow in Google Maps iOS SDK

前端 未结 6 562
悲&欢浪女
悲&欢浪女 2020-12-03 05:04

I\'m returning a UIImageView in - (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker;

This UIImageView loads imag

6条回答
  •  眼角桃花
    2020-12-03 05:39

    There you are . just a few lines of simple code . This work perfectly for me . Add these lines of code right after you finish download an image I mean in your completionBlock .

         let image = UIImage(contentsOfFile: fileURL.path!)
    
          marker.image  = image
    
                if(self.mapView.selectedMarker != nil)
                {
                  if(self.mapView.selectedMarker == marker)
                  {
                    self.mapView.selectedMarker = nil
                    self.mapView.selectedMarker =  marker
                  }
                }
    

    Then it works so freaking awesome . The content are reloaded with new image immediately Basically you still have to assign new image to your marker.image to use it in your "markerInfoContents" method

提交回复
热议问题