3

In my App for iPhone/iPad(in Objective C), there is a UiWebView which loads any site(by typing the URL). My UiWebView loads site successfully and it can be scrolled and Zoomed successfully.

But my app requirement is that the UiWebView will ZoomIn more than the specified mimimum Zoom level of UiWebView. My code used for setting my Zoom levals is:

webview.scrollView.minimumZoomScale=0.5;
webview.scrollView.maximumZoomScale=10.0;
webview.scrollView.zoomScale=webview.scrollView.minimumZoomScale;

By seeing the minimumZoomScale=0.5, it sets the Zoom level correctlt. But as soon as I started Zooming it out it Zoomed out the default minimum level and further it can not be Zoomed in at my described Zoom levels.

Please let me know if somebody has any idea or solution.

Mandeep Kaur
  • 183
  • 4
  • 17
  • 1
    Does any body not having any idea? Please help me I am totally stuck with this. I have also tried to use the **Meta** tag. In this I have applied the > maximum-scale=10.0 initial-scale=0.1 minimum-scale=0.1 This works fine for me for the web based websites but for the mobile versions......its just blurry. – Mandeep Kaur Feb 16 '12 at 05:44
  • Sorry that this is no help, but I tried this out (I'm having a related problem and figured I might learn something here that could help me), and verified that it is as you say: when you set your initial zoom scale to your minimum zoom scale (which is less than 1) and then zoom out, you can't zoom back down to your minimum. I tried setting the 'scalesPagesToFit' attribute to 'NO', but that had no effect. Like I said, this is likely no help, but at least you now have confirmation that this is happening to others as well. – Kyle Humfeld Aug 29 '12 at 21:43

1 Answers1

1

I used this answer: https://stackoverflow.com/a/10699622/422338

It seems that the UIWebView's max/min zoom levels are set from the web page (and hence the settings you provide to webView.scrollView.minimumZoomScale are ignored).

If you do not have control of the HTML site being visited, you could do a "hack" to inject a meta tag via javascript (using the stringByEvaluatingJavaScriptFromString: method on UIWebView). Would this suit your needs? If you get it working, let me know :).

Community
  • 1
  • 1
Johnus
  • 722
  • 6
  • 12