I have to load an html string onto the UIWebView with 'LoadHTMLString' method of UIWebView.
Please find the below code.
[wv loadHTMLString:[NSString stringWithFormat:@"<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\"><meta charset=\"utf-8\"><title>Traffic layer</title><style>html, body, #map-canvas {height: 100%%;margin: 0px;padding: 0px}</style><script src=\"https://maps.googleapis.com/maps/api/js?v=3.exp\"></script><script>function initialize() {var myLatlng = new google.maps.LatLng(34.04924594193164, -118.24104309082031);var mapOptions = {zoom: 13,center: myLatlng}var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptiotrafficLayer.setMap(map);}google.maps.event.addDomListener(window, 'load', initialize);</script></head><body><div id=\"map-canvas\"></div></body></html>"] baseURL:nil]
When I load this, my webview is empty, it is not showing anything.
When I put this code into file with the extension 'html' and load on to the webview it is working fine.
Can any one help me in loading this on to the WebView? Or could any one let me know what is going wrong in this code.