2012-12-04 69 views

回答

2

您還是應該使用該方法,然後獨立配置每個單元。只要確保你的設置是不是你的建築塊

UITableViewCell *cell = [tableView dequeue..]; 
if (!cell) { 
    cell = ...; 
} 

cell.image = ...; 
+0

謝謝,它的工作 – Shoaib

0

項目將您的圖像

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

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"]]; 
    cell.selectionStyle = UITableViewCellSelectionStyleNone; 
} 
NSDictionary *item = (NSDictionary *)[self.content objectAtIndex:indexPath.row]; 
cell.textLabel.text = [item objectForKey:@"mainTitleKey"]; 
cell.detailTextLabel.text = [item objectForKey:@"secondaryTitleKey"]; 
NSString *path = [[NSBundle mainBundle] pathForResource:[item objectForKey:@"imageKey"] ofType:@"png"]; 
UIImage *theImage = [UIImage imageWithContentsOfFile:path]; 
cell.imageView.image = theImage; 
return cell; 
    } 
相關問題