fill UIWebView with local "loading" image before internet content
I have a UITableView with header as a uiwebview (320*44px) for pub content. I wonder how to show some local content image or a background color or whatev开发者_运维百科er before the content get loaded from the web ??
(goal: eleminate the white default background for not-loaded uiwebview banner)
//i assume ur webview object name as webView;
//i assume u were use delegate to ur webview by specifing after creating the webview like
webView.delegate=self;
//dont forget to in .h file @interface urViewController : vijayviewController<UIWebViewDelegate> { <UIWebViewDelegate> is matter.
UIImageView *imageView=[[UIImageView alloc]initWithFrame:webView.bounds];
[imageView setImage:[UIImage imageNamed:@"vijay.png"]];//image size should ur specification 320*44px
[imageView setTag:55];
[webView addSubview:imageView];
[imageView release];
//to remove image
// [[webView viewWithTag:55] removeFromSuperview];
- (void)webViewDidFinishLoad:(UIWebView *)webView{
[[webView viewWithTag:55] removeFromSuperview];
}
精彩评论