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)
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
Post a Comment