使用下面的代码,如何在此表视图的每个部分中放置图像。
switch (indexPath.section) {
case TYPE_SECTION: // type -- should be selectable -> checkbox
text = [patient.type valueForKey:@"name"];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
break;
case NOTES_SECTION:
text = @"Notes Entry";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.editingAccessoryType = UITableViewCellAccessoryNone;
break;
case SCHEDULES_SECTION:
text = @"Appointments Entry";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.editingAccessoryType = UITableViewCellAccessoryNone;
break;
case LAB_SECTION:
text = @"Labs Entry";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.editingAccessoryType = UITableViewCellAccessoryNone;
break;
case STATUS_SECTION:
text = @"Status Entry";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.editingAccessoryType = UITableViewCellAccessoryNone;
break;
default:
break;
}
cell.textLabel.text = text;
}
return cell;
}
答案 0 :(得分:0)
// snip
case STATUS_SECTION:
text = @"Status Entry";
cell.accessoryType = UITableViewAccessoryTypeDisclosureIndicator;
cell.editingAccessoryType = UITableViewCellAccessoryNone;
[cell.imageView setImage:[UIImage imageNamed:@"any-image-in-my-project.png"]];
break;
// snip