How to prevent initial white flash when showing a UIWebView?

后端 未结 4 1538
北恋
北恋 2020-12-08 14:28

I use a UIWebView to show an \"About\" screen by displaying a bundled HTML file. My app\'s view hierarchy is: UITabBarController / UIViewCont

4条回答
  •  北海茫月
    2020-12-08 14:57

    I also encountered the same problem , the solution I found is as follows.

    -(void)viewDidLoad {
      [super viewDidLoad];
    
      [_webView setOpaque:NO];
      _webView.backgroundColor = [UIColor clearColor];
      self.webView.hidden = YES;
    }
    
    -(void)webViewDidFinishLoad:(UIWebView *)webView {
    
     //...........................
    
     self.webView.hidden = NO;
    }
    

提交回复
热议问题