开发者

How to make UIWebView not act like a browser on the iPhone

开发者 https://www.devze.com 2023-01-06 17:31 出处:网络
My app loads webpages off the internet using a UIWebView. However I\'d like to modify the exper开发者_如何学JAVAience so the user won\'t perceive it to be a webpage. What are some of the things I can

My app loads webpages off the internet using a UIWebView. However I'd like to modify the exper开发者_如何学JAVAience so the user won't perceive it to be a webpage. What are some of the things I can do? and how to do it?

examples: - Show the page when everything is loaded? - Fade in effect?

Suggestions please.


It is possible to monitor the delegate callbacks from UIWebView to determine when the page has finished loading, and then perform whatever visual effect you want at that time. If the web view is most or all of your view controller, you could defer pushing your view controller until that time, or you could fade in the view as you mentioned.

However, even when reading HTML from the local disk, there is a noticeable lag. Waiting for remote content to load will have even more latency. You also must deal with the realities of an unreliable network: sometimes, your content will never arrive.

Once the first page is loaded and displayed, though, your options will be limited. If you try to make it appear that it is a fully native application, it's going to be hard to explain the latency or why it doesn't run when the network is unavailable (airplane mode, no cell or Wi-Fi).


I assume you are wanting to display the page as if it is a resource contained within your app (and not something streaming from a browser?)

In this case, download the webpage to a local file and display it only once fully downloaded.

I provide sample code in this answer that you can easilyy adapt for a html page (rather than a pdf document)

0

精彩评论

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

关注公众号