从 UIWebView 中移除阴影

Removing shadows from UIWebView(从 UIWebView 中移除阴影)

本文介绍了从 UIWebView 中移除阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 web 视图来显示小的 pdf 文件.为了美观,我想删除 PDF 周围的灰色边框.有什么办法吗?我查看了各种资源,这些资源似乎都不起作用,或者解决方案在 iOS5 中不再起作用.

I use a web view to display small pdf files. In the interest of aesthetics, I'd like to remove the grey border around the PDF. Is there any way around it? I've looked at various resources none of which seem to work or the solution no longer works in iOS5.

另外,如果只有一页,有没有办法停止滚动?

Also, is there any way of stopping the scroll if there's only one page?

谢谢.

推荐答案

阴影实际上是 UIScrollView 的 UIImageView 子视图(或 iOS5 UIWebView 中的等价物).

The shadows are actually UIImageView subviews of the UIScrollView (or the equivalent in iOS5 UIWebView).

所以在 iOS4 中:

So in iOS4:

for (UIView* subView in [webView subviews])
{
    if ([subView isKindOfClass:[UIScrollView class]]) {
        for (UIView* shadowView in [subView subviews])
        {
            if ([shadowView isKindOfClass:[UIImageView class]]) {
                [shadowView setHidden:YES];
            }
        }
    }
}

iOS5 及以上版本:

and in iOS5 and above:

for (UIView* shadowView in [webView.scrollView subviews])
{
    if ([shadowView isKindOfClass:[UIImageView class]]) {
        [shadowView setHidden:YES];
    }
}

这篇关于从 UIWebView 中移除阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:从 UIWebView 中移除阴影

基础教程推荐