google maps - iOS - GoogleMaps SDK: Using WKWebView for a custom info window does not load contents -




setup

  • ios 10.0
  • xcode 8.3.3
  • swift 3.1
  • googlemaps sdk 2.2.0

problem

when trying replace contents of marker's info window per documentation on markerinfocontents wkwebview, infowindow remains blank. happens if using markerinfowindow.

background

this seems happen when trying refresh other contents (ref), since infowindow rendered static image (even if comes uiview) mentioned in google docs.

other people have replaced view completely, using smcalloutview lib (ie: along lines of getting screen location of infowindow , adding subview)

  • ref. 1
  • ref. 2
  • ref. 3

question

is there way use wkwebview? managed make load contents configuring marker marker.tracksinfowindowchanges = true, when tapping marker infowindow, cpu gets stuck in excessive use, if webview reload continuously or couldn't figure out yet.

example code

func mapview(_ mapview: gmsmapview, markerinfocontents marker: gmsmarker) -> uiview? {     //fixme: can not use webview     if let taskid = marker.userdata as? int {         if let task = self.taskmap[taskid] {             let infoframe = cgrect(x: 0, y: 0, width: 100, height: 100)             let infoconfig = wkwebviewconfiguration()             infoconfig.preferences.javascriptenabled = false             let webview = wkwebview(frame: infoframe, configuration: infoconfig)             let contents = "<h1>hi</h1><br/>there"             webview.loadhtmlstring(contents, baseurl: nil)             webview.scrollview.isscrollenabled = false             webview.scrollview.showsverticalscrollindicator = false             webview.scrollview.showshorizontalscrollindicator = false             webview.scrollview.bounces = false              return webview         }     }     return nil } 





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -