tags:

views:

38

answers:

1

Hello everyone

I know using 'setEditing' to enable the edit(delete) of UITableView

But I prefer to disable the operation for some certain rows(enable other rows).

Is it possible?

Thanks

interdev

A: 

Implement the -tableView:canEditRowAtIndexPath: method in your data source. Return NO for those rows.

KennyTM
Thanks. But I hope the certain rows(all rows can be moved) can be moved rather than delete (certain rows are disabled the delete function, the others are enabled), Is it possible?
@user: Use `-tableView:canMoveRowAtIndexPath:` for moving.
KennyTM
Thanks. I used- (BOOL)tableView:(UITableView *)tableview canMoveRowAtIndexPath:(NSIndexPath *)indexPath { return YES; }- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;{ NSInteger row=[indexPath row]; int vv=[[myArray objectAtIndex:row] isEditable]; if (!vv) { return NO; } else { return YES; }}but it looks like impossible to set a cell 'enable move' and 'disable delete' at the same time.
@user: Have you set the cell's [`.showsReorderControl` property](http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006938-CH3-SW15) to YES?
KennyTM