Iphone 如何在表格的单元格中设置差异图像

Iphone 如何在表格的单元格中设置差异图像,iphone,objective-c,Iphone,Objective C,如何在UItable视图中为每个单元格设置不同的图标图像。在tableview代理中: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusab

如何在UItable视图中为每个单元格设置不同的图标图像。

在tableview代理中:

- (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];
    }
    cell.imageView.image=[someDataClass methodThatReturnsAnImage]; 
    cell.textLabel.text=[someDataClass methodThatReturnsAString]; 
    return cell;
}