Hi, I have a map image in a uiwebview. It default loads in the top left hand corner. I would like it to initialize in the center of the uiwebview.
Does anyone know how to do this?
Thanks!
Hi, I have a map image in a uiwebview. It default loads in the top left hand corner. I would like it to initialize in the center of the uiwebview.
Does anyone know how to do this?
Thanks!
If the map image is the only thing in the page, is it wrapped in an html page? If it is at least wrapped in a body tag you could do the following:
NSString *bodyStyle = @"document.getElementsByTagName('body')[0].style.textAlign = 'center';";
NSString *mapStyle = @"document.getElementById('mapid').style.margin = 'auto';";
[webView stringByEvaluatingJavaScriptFromString:bodyStyle];
[webView stringByEvaluatingJavaScriptFromString:mapStyle];
Let me know how exactly your html is structured and then I can provide some more information if necessary.