相关疑难解决方法(0)

UIWebView背景设置为"清除颜色",但它不透明

我正在使用iOS SDK最新版本和XCode 4.2开发iOS 4应用程序.

我有一个XIB,UIWebView其中Alpha = 1.0,背景设置为Clear Color,Opaque未设置.在这个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;
}
Run Code Online (Sandbox Code Playgroud)

UIWebView是否显示静态的html:

<html><head></head><body style=\"margin:0 auto;text-align:center;background-color: transparent; color:white\">...</body></html>
Run Code Online (Sandbox Code Playgroud)

在iOS 5模拟器上,它的背景是透明的,但在iOS 4设备上是灰色的.

任何线索?

iphone cocoa-touch objective-c uiwebview ios

141
推荐指数
3
解决办法
7万
查看次数

标签 统计

cocoa-touch ×1

ios ×1

iphone ×1

objective-c ×1

uiwebview ×1