如何在显示UIWebView时防止初始白色闪烁? [英] How to prevent initial white flash when showing a UIWebView?

查看:194
本文介绍了如何在显示UIWebView时防止初始白色闪烁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 UIWebView 通过显示捆绑的HTML文件来显示关于屏幕。我的应用程序的视图层次结构是: UITabBarController / UIViewController / UIWebView

I use a UIWebView to show an "About" screen by displaying a bundled HTML file. My app's view hierarchy is: UITabBarController / UIViewController / UIWebView.

问题是,HTML页面有深色背景,第一次轻击标签时,在显示Web视图之前,会短暂显示一个白色背景。我尝试设置 UIWebView 的背景颜色,但这不解决问题。无论是加载 viewDidLoad viewWillAppear 中的内容,都会出现问题。

The problem is that the HTML page has a dark background, and the very first time the tab is tapped, a white background is visible briefly before the web view is displayed. I tried setting the background color of the UIWebView, but that doesn't solve the problem. The problem occurs whether I load the content in viewDidLoad or viewWillAppear.

推荐答案

[webView setOpaque:NO];
webView.backgroundColor = [UIColor clearColor];

这篇关于如何在显示UIWebView时防止初始白色闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆