我正在使用iOS SDK最新版本和XCode 4.2開發iOS 4應用程序。UIWebView背景設置爲清除顏色,但不透明
我有一個UIWebView
一個XIB與阿爾法= 1.0,背景設置爲清除顏色和不透明未設置。在此XIB餘設置的圖像作爲背景與此代碼:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"AboutBackground.png"]];
self.view.backgroundColor = background;
[background release];
}
return self;
}
的UIWebView
是示出靜態html:
<html><head></head><body style=\"margin:0 auto;text-align:center;background-color: transparent; color:white\">...</body></html>
在iOS 5模擬器,其背景是透明的,但在一個iOS 4的設備是灰色的。
任何線索?
可能重複【如何做一個透明的UIWebView(http://stackoverflow.com/questions/ 3646930/how-to-make-a-transparent-uiwebview) – Vladimir 2012-07-31 13:44:44
嘗試在界面生成器中將UIImageView放到您的webview中,並將其設置爲您的圖像。 – Stas 2011-12-29 11:17:08
感謝您的回答,但網頁視圖並未填滿整個屏幕。 – VansFannel 2011-12-29 11:25:10