iPhone - TableView editing and still be able to select
I am trying to make a table view that should be half editable and half selectable. I can’t get this to work. Do anyone know h开发者_如何学编程ow to make this possible. I need to be able to reorder one section of the table view and the other section i need to be able to select.
Also I only want the ReorderControl to be shown, without any other editable control to show. When I make it editable it shrinks my table cells to be smaller. Is there anyway to remove this?
There are several properties on UITableView
that will help you out.
[tableView setAllowsSelectionDuringEditing:YES];
Also, the UITableViewDelegate protocol has the following method:
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
Just return NO
where ever you want the row to not resize.
You can use the delegate method tableView:editingStyleForRowAtIndexPath:
to say which rows you want to be able to delete, and the data source method tableView:canMoveRowAtIndexPath:
for the reordering.
精彩评论