如何制作透明的 UIWebView [英] How to make a transparent UIWebView

查看:27
本文介绍了如何制作透明的 UIWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 UITableView 和每行相应详细信息视图的应用程序.在详细视图中,我必须显示一些文本和背景图像(每行的文本不同,但图像保持不变).在我看来,最简单的方法是将文本放在 .rtf 文件中,然后在 UIWebView 中显示.然后只需在 UIWebView 后面放一个 UIImageView.

I have an app with a UITableView and a corresponding detail view for each row. In the detail view I have to display some text and a background image (text is different for each row, but the image remains the same). The easiest way, in my opinion, is to put the text in an .rtf file and display it in a UIWebView. Then just put a UIImageView behind the UIWebView.

我尝试在 IB 中将 UIWebView 的不透明度设置为零,但没有帮助.

I've tried to set the UIWebView's opacity to zero in IB, but it didn't help.

你能帮我吗?

推荐答案

我推荐:

webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];

(在Interface Builder中设置这些属性适用于iOS 5.0+,但对于iOS 4.3你必须在代码中设置backgroundColor)

(setting these properties in Interface Builder will work for iOS 5.0+, but for iOS 4.3 you must set the backgroundColor in code)

并将其包含在您的 HTML 代码中:

And include this into your HTML code:

<body style="background-color: transparent;">

这篇关于如何制作透明的 UIWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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