今天想改一下WebView的背景色,使用了

如下两种常规的修改背景色的方法都不行

tintWebView.backgroundColor = [UIColor greenColor];

 tintWebView.scrollView.backgroundColor = [UIColor greenColor];

后来找到解决方法:

使用

[tintWebView setBackgroundColor:[UIColor redColor]];

 [tintWebView setOpaque:NO];//加上这一句就能修改背景色

 

**********************************************************************

如果UIWebView的高度是200,而UIWebView的内容的高度是600,如果不做设置,UIWebView默认只显示前200高度的内容。

那么,如果有需求显示最后200高度的内容,就需要设置一下UIWebView的可视区域

设置代码如下:

[tintWebView.scrollView scrollRectToVisible:CGRectMake(tintWebView.frame.origin.x, tintWebView.scrollView.contentSize.height-tintWebView.scrollView.frame.size.height, tintWebView.frame.size.width, tintWebView.frame.size.height) animated:YES];

这样子就能展示UIWevView最后部分的内容

posted on 2014-08-28 09:56  瓜甜甜  阅读(519)  评论(0编辑  收藏  举报