3 回答
TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超2個(gè)贊
我建議:
webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];
(在Interface Builder中設(shè)置這些屬性將適用于iOS 5.0+,但對于iOS 4.3,必須在代碼中設(shè)置backgroundColor )
并將其包含到您的HTML代碼中:
<body style="background-color: transparent;">
TA貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超9個(gè)贊
使用下面的遞歸方法從UIWebView中刪除漸變:
[webView setBackgroundColor:[UIColor clearColor]];
[self hideGradientBackground:webView];
- (void) hideGradientBackground:(UIView*)theView
{
for (UIView * subview in theView.subviews)
{
if ([subview isKindOfClass:[UIImageView class]])
subview.hidden = YES;
[self hideGradientBackground:subview];
}
}
TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個(gè)贊
快速更新:
webView.opaque = true
webView.backgroundColor = UIColor.clearColor()
再說一次,別忘了設(shè)置
<body style="background-color: transparent">
或者,最好在樣式表中使用內(nèi)聯(lián)樣式代替內(nèi)聯(lián)樣式:
body {
background-color: transparent
}
- 3 回答
- 0 關(guān)注
- 523 瀏覽
添加回答
舉報(bào)
