How to set background color for UIWebView in iPhone sdk

纵饮孤独 提交于 2019-12-05 05:59:14

[webView setOpaque:NO];

A webview will display a document, so background color is really nothing that makes a lot of sense here. If you want to display something while no page is loaded, build a placeholder page containing your background.

If you want to display a specific background before the UIWebView has loaded HTML content you can add a loading view over the top and then remove it when you get webViewDidFinishLoad on your UIWebViewDelegate:

- (void)webViewDidFinishLoad:(UIWebView *)webView

If you need to set the background color on the UIWebView once it has loaded the content, then you would do this in the HTML/CSS markup:

"background-color: #026dec;"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!