简体   繁体   中英

How can I make the content of a UIWebView load with an animation?

I have a UIWebView that I am loading with a string full of HTML. There are times when I am paging through the content quickly, and when the app catches up, the UIWebView loads the HTML and it just pops up there.

I want to somehow make it a little more visually appealing. Is there a way to subtly fade into the content of the webView? Make it a little less shocking?

Thanks!

You could set the webview's .alpha value to 0 , and animate it to 1 when the webpage is done loading.

To determine if the webpage is loaded and rendered, either use the webview delegate methods, or add a piece of javascript to the page (if possible) to explicitly call back when the page load is finished. You can simply do <script language=javascript>window.location="done:";</script> and catch the load of this done: url in you webview delegate method ( -webview:shouldStartLoadWithRequest: )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM