UIWebView-加载内容之前为白色背景 [英] UIWebView - white background before loading content
本文介绍了UIWebView-加载内容之前为白色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题.我有一个菜单,当我单击它时,它将通过UIWebView从URL远程加载内容.
当我尝试使用模拟器时,在加载内容之前,背景为白色,然后加载HTML页面(背景为深色)
演示:
>
当我单击"KALENDER"时,您会看到白色的闪光
如何解决此问题?
我的UIWebView看起来像这样:
让myWebView:UIWebView = UIWebView(frame:CGRectMake(0,0,UIScreen.mainScreen().bounds.width,UIScreen.mainScreen().bounds.height))myWebView.loadRequest(NSURLRequest(URL:NSURL(string:"http://website.com/test.html")!))self.view.addSubview(myWebView)
谢谢!
解决方案
所以,我所做的就是添加了:
myWebView.opaque = falsemyWebView.backgroundColor = UIColor.clearColor()
在控制器上,我没有从查看"中选中它
I have a question. I have a menu, when I click on it, it will load content remotely from URL via UIWebView.
When I try on simulator, before loading the content, there's a white background and then loads my HTML Page (which has dark background)
Demo:
You can see that white flash, when I click on "KALENDER"
How can I fix this issue?
My UIWebView looks like this:
let myWebView:UIWebView = UIWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))
myWebView.loadRequest(NSURLRequest(URL: NSURL(string: "http://website.com/test.html")!))
self.view.addSubview(myWebView)
Thank you!
解决方案
So, what I did, is, added:
myWebView.opaque = false
myWebView.backgroundColor = UIColor.clearColor()
and at controller, I unchecked this from "View"
这篇关于UIWebView-加载内容之前为白色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文