Is it possible to create comb开发者_StackOverflow社区o box list items with multiple sections in IPhone ? Items List will display same way as we in UITableView.
Do you mean that you want to use UITableView to display a list for selection?
If you want multiple sections, simply make your numberOfSectionsInTableView method return the number of sections you want. And implement the didSelectionRowAtIndexPath to do whatever you want to do with the selection.
If you mean to say "multiple-selection", you can implement some toggle logic in didSelectRowAtIndexPath, the example below uses the selected property to keep track and use the checkmark acceryType as UI marker. You can also add your own checked property or use the highlighted row as UI indicator.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
cell.selected = YES;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selected = NO;
}
}
I suggest you use a UIiNavigationController
together with your UITableView. That way you can add an 'OK' or 'Done' button on the nav bar and make the action of that button pop this view and process the all the selected items.
精彩评论