【发布时间】:2012-03-03 15:40:54
【问题描述】:
我需要将两张图片放入 iOS 表格视图中。
我使用此代码将图像放置在单元格中:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
UIImage *cellImage = [UIImage imageNamed:@"verde_diversos.png"];
cell.imageView.image = cellImage;
cell.textLabel.text = [self.colorNames objectAtIndex: [indexPath row]];
return cell;
}
帮助?
【问题讨论】:
标签: iphone ios image ipad uitableview