删除或更改 UIWebView 文档显示周围框架的颜色? [英] Remove or change color of frame around UIWebView document display?

查看:25
本文介绍了删除或更改 UIWebView 文档显示周围框架的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 UIWebView 来显示嵌入到我的主视图中的各种文件类型(所以我不能使用专门的 PDF 查看器)(所以我不能使用模态文档交互控制器).我的主视图的背景设计与 UIWebView 中文档周围出现的浅灰色框架相冲突.有没有人知道如何删除那个灰色框,使它透明或改变它的颜色?

I'm using a UIWebView to display a variety of file types (so I can't use a specialized PDF viewer) embedded into my main view (so I can't use a modal document interaction controller). My main view has a background design that clashes with the light gray frame that appears around documents in the UIWebView. Does anyone know a way to remove that gray frame, make it transparent or change its color?

我熟悉并使用了改变UIWebView 的背景颜色 以避免加载时出现颜色闪烁",以及 删除过度滚动"Web 视图时出现的顶部和底部阴影,但我还没有看到任何人解决这个灰色框架.(它只在显示 .doc 或 .pdf 等文档时出现,而不是在显示 HTML 内容时出现.)我隐藏了作为 UIWebView's 滚动视图的子视图的所有图像,所以显然这是来自其他地方.

I'm familiar with and have used the techniques for changing the background color of the UIWebView to avoid a "color flash" while it loads, and for removing the top and bottom shadow that appear when "overscrolling" the web view, but I haven't seen anyone address this gray frame. (It only appears when displaying documents like .doc or .pdf, not when displaying HTML content.) I've hidden all the images that are subviews of the UIWebView's scroll view, so apparently this is coming from somewhere else.

推荐答案

这个问题是在 iOS 4 发布时写的,但在 iOS 5 及更高版本中,只需设置 UIWebView 的 backgroundColor 和 opaque 属性将删除该灰色框:

This question was written while iOS 4 was current, but in iOS 5 and later, simply setting the backgroundColor and opaque properties of the UIWebView will remove that gray frame:

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

这篇关于删除或更改 UIWebView 文档显示周围框架的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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