开发者

Uiwebview refreshes after zoom and pinch

开发者 https://www.devze.com 2023-01-01 19:57 出处:网络
I have a uiwebview in my App. So far everything works fine开发者_开发问答, but when i zoom in or out for example the uiwebview refreshes the loaded page and then scrolls and zooms to the new page loca

I have a uiwebview in my App. So far everything works fine开发者_开发问答, but when i zoom in or out for example the uiwebview refreshes the loaded page and then scrolls and zooms to the new page location and size. So the zooming works good, but I don't want the user to see the refresh and repositioning of the website.

Is there a way to prevent this?

Thanks for any tips!


This could be because you might have coded your zoom in an odd way. You could try deleting all your zoom code, and in the same method where you have your webView loadRequest, type:

self.webView.scalesPageToFit = YES

Hope this helps.


You should refresh your page dynamically, instead of refreshing it through the webview. You can accomplish this by using AJAX or retrieving the content in Objective C and injecting it using stringByEvaluatingJavaScriptFromString:.

0

精彩评论

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

关注公众号