Eri*_*ith 18
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
static NSString* CellIdentifier = @"Cell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = [[[UITableViewCell alloc] UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.text = @"I'm a UITableViewCell!";
cell.imageView.image = [UIImage imageNamed:@"MyReallyCoolImage.png"];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
那么,要将图像添加到表格单元格,您可以将 UIImage 添加到子标题 UITableViewCell 或您自己的自定义单元格的图像属性中。我会在developer.apple.com 上阅读有关自定义UITableViewCells 的文档。
归档时间: |
|
查看次数: |
19777 次 |
最近记录: |