UIWebView solves the problem of blank background during page loading, while uiwebview is blank
During UIWebView loading, a blank area is displayed before the page is loaded. To solve this problem, follow these steps:
Method 1: make the background of UIWebView transparent.
webView.backgroundColor = [UIColor clearColor];webView.opaque = NO;[webView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"webbg.png"]]];
Method 2:
First, set the frame of webView to 0. After the page is loaded, set the frame to the original size.
Method 3:
In viewDidLoad, overwrite a background view on the WebView.
self.webView=[[[UIWebView alloc]initWithFrame:self.view.bounds]autorelease]; [self.webView loadRequest:request]; [self.view addSubview:self.webView]; UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"gatewaybg.png"]]; imageView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height); [self.view addSubview:imageView];
After the WebView is loaded, place the view to the top or remove the background view.
-(Void) webViewDidFinishLoad :( UIWebView *) Place webView {// WebView to the top layer [self. view bringSubviewToFront: self. webView]; // You can also remove the background image from the [self. webView removeFromSuperview];}