2010-07-12 7 views
0

je suis en train de charger une image dans UIWebView dans une cellule tableView utilisantutilisez UIWebview dans une cellule TableView?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString *CellIdentifier = @"Cell"; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 
} 

NSInteger Index=indexPath.row; 
switch (Index) 
{ 

case 0: 

[cell.contentView addSubview:webView]; 

     NSString *str=[[NSString alloc]initWithFormat:@"%@",[appDelegate.respSrcUrl objectAtIndex:0]]; 

     NSURL *url = [NSURL URLWithString: str]; 

     NSString *htmlString = @"<html><body><img src='%@' width='900'></body></html>"; 
     NSString *imageHTML = [[NSString alloc] initWithFormat:htmlString,url]; 


     webView.scalesPageToFit = YES; 

     [webView loadHTMLString:imageHTML baseURL:nil]; 


break; 

default: 

break; 
} 

mais aucune image ne se chargé dans le WebView. comment puis-je afficher l'image dans le webview ??

Répondre

0

Assurez-vous de return cell; à la fin de la méthode déléguée.

+0

le webview affiche mais l'image ne se charge pas ?? – hemant

+0

On dirait qu'il n'a pas réussi à coller toute la méthode – willcodejavaforfood

Questions connexes