【问题标题】:How to change webview color at time of loading URL?如何在加载 URL 时更改 webview 颜色?
【发布时间】:2011-09-23 10:37:25
【问题描述】:

在我的应用中,

我在 webview 中打开一个 url,

但是在webview中打开一个url需要一些时间,

在那段时间内webview显示白色背景,

我想改变那个背景。

我试试

 webView.backgroundColor=[UIColor blackColor];

它不适合我

那么,我该怎么做呢?

【问题讨论】:

    标签: iphone objective-c cocoa-touch ios4 webview


    【解决方案1】:

    创建时

     [webView setBackgroundColor:[UIColor clearColor]];
     [webView setBackgroundColor:[UIColor purpleColor]];
     [webView setOpaque:NO];
    
    
     - (void)webViewDidFinishLoad:(UIWebView *)webView{
    
        [webView setOpaque:YES];
        [webView setBackgroundColor:[UIColor whiteColor]];
    
    
    
     }
    

    【讨论】:

      【解决方案2】:
      - (void)webViewDidFinishLoad:(UIWebView *)webView
      {
          webView.backgroundColor=[UIColor whiteColor];
      
      }
      - (void)webViewDidStartLoad:(UIWebView *)webView
      {
         webView.backgroundColor=[UIColor blackColor];
      
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-01-29
        • 2019-01-15
        • 2016-03-10
        • 1970-01-01
        • 2017-05-24
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多