开发者

Resolution after zooming UIWebView

开发者 https://www.devze.com 2023-03-25 23:47 出处:网络
After zooming a UIWebView which is loaded with an HTML string, the content is开发者_开发知识库 blurred. How can I fix this?Make sure that the @property(nonatomic) BOOL scalesPageToFit property of your

After zooming a UIWebView which is loaded with an HTML string, the content is开发者_开发知识库 blurred. How can I fix this?


Make sure that the @property(nonatomic) BOOL scalesPageToFit property of your UIWebView instance is set to YES (default value is NO).

What content specifically is blurred? Graphic content will become blurred once it has been zoomed in too much.


There is currently no way to solve it.

However, you can easily solve it when iOS 5.0 is out.

UIWebView has a UIScrollView subview in 5.0, so you can set the Maximum Scale Factor.


I have a odd-solution.

To Zoom scrollView:

if (!self.webView.scrollView.isZooming) {
    [self.webView.scrollView setZoomScale:scale];
}

The zooming is done:

CGFloat differenceForReload = 0.001f;
[self.webView.scrollView setZoomScale:scale - differenceForReload];
[self.webView.scrollView setZoomScale:scale + differenceForReload
                             animated:YES];
0

精彩评论

暂无评论...
验证码 换一张
取 消