3 回答

TA貢獻1848條經驗 獲得超2個贊
我建議:
webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];
(在Interface Builder中設置這些屬性將適用于iOS 5.0+,但對于iOS 4.3,必須在代碼中設置backgroundColor )
并將其包含到您的HTML代碼中:
<body style="background-color: transparent;">

TA貢獻1853條經驗 獲得超9個贊
使用下面的遞歸方法從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貢獻1828條經驗 獲得超3個贊
快速更新:
webView.opaque = true
webView.backgroundColor = UIColor.clearColor()
再說一次,別忘了設置
<body style="background-color: transparent">
或者,最好在樣式表中使用內聯樣式代替內聯樣式:
body {
background-color: transparent
}
- 3 回答
- 0 關注
- 498 瀏覽
添加回答
舉報