2012-03-04 6 views
1
ContactInfo *data = [self.contacts objectAtIndex:[indexPath row]]; 

cell.textLabel.text = data.name; 
cell.detailTextLabel.text = data.designation; 
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 


NSString *filePath = [[NSBundle mainBundle] pathForResource:data.image ofType:@"png"]; 

NSLog(@"%@",filePath); 

UIImage *image1 = [UIImage imageWithContentsOfFile:filePath]; 
cell.imageView.image = image1; 

return cell; 

ここで私は右のセルデータと詳細テキストラベルを取得しますが、画像ビューは表示されません。別の画像が必要です。いずれかがアドバイスを受けることができる場合。SQLデータベースからテーブルビューセルに画像をロード

+0

NSLogの出力は? – Geoffroy

答えて

0

NSString *filePath = [[NSBundle mainBundle] pathForResource:data.image ofType:@"png"]; 
    NSData *imageData=[NSData dataWithContentsOfURL:[NSURL URLWithString:filePath]]; 

    UIImage *itemImage=[[UIImage alloc]initWithData:imageData cache:YES] ; 

は今、あなたはFetch image from database in Iphone

に従うことができます詳細については

cell.imageView.image = itemImage; 

として、このイメージオブジェクトを使用し、NSDataのように、データベースから画像を取得してから、画像オブジェクトは、このNSDataオブジェクトを初期化します

+0

@ user1203289このコードを実装しましたか? –

+0

ええ、私はそれを済ませた –