How to load local images in webview in Iphone sdk?

Posted by monish on Stack Overflow See other posts from Stack Overflow or by monish
Published on 2010-03-30T07:41:14Z Indexed on 2010/03/30 7:53 UTC
Read the original article Hit count: 512

Filed under:

Hi guys,

Here I am getting a problem when I am loading local Image in the webview using html code my image was not diplaying in my webview here is my code for Loading the local image in webview:

  htmlString = [htmlString stringByAppendingString:@"<table width=85% cellpadding=3  cellspacing=0 border=0> "];
  htmlString = [htmlString stringByAppendingString:@"<tr>"];
  htmlString = [htmlString stringByAppendingString:@"<td >"];
  htmlString = [htmlString stringByAppendingString:@"<div align='Right'><a href='/reviews/"];

  htmlString = [htmlString stringByAppendingString:@"'>"];
  htmlString = [htmlString stringByAppendingString:@"<img src ='reviews1.jpg' BORDER=0 HEIGHT=148 WIDTH=110/>"];



  htmlString = [htmlString stringByAppendingString:@"</a>"];


    - (BOOL)webView:(UIWebView*)webView2 shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {

 //CAPTURE USER LINK-CLICK.
 if (navigationType == UIWebViewNavigationTypeLinkClicked) {
  NSURL *aURL = [request URL];
  NSString* aurlString = [aURL absoluteString];

   if ( [aurlString rangeOfString:@"/reviews/"].location != NSNotFound)
  {
   [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
   ReviewWebViewController*  viewController  = [[ReviewWebViewController alloc] init];

   viewController.loadUrl=[techProducts techProductReviewUrl];
   [self.navigationController pushViewController:viewController animated:YES];
   [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

   [viewController release];

   return NO;
  }
    }
    }

Here no image was displaying only ?mark is displaying .

guys pls help me to get out of dis prb.

Thank you, Monish.

© Stack Overflow or respective owner

Related posts about objective-c