tags:

views:

188

answers:

3

Hi all,

On my iphone app, I have a UITableView in edit mode, where user is allowed only to reorder the rows no delete permission is given.

So is there any way where I can hide "-" red button from TableView. Please let me know.

Thanks

A: 

canEditRowAtIndexPath in UITableViewDataSource is the function you want - return NO. canMoveRowAtIndexPath, allowing you to move rows, is something else.

Adam Eberbach
Not working, If I add - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ return FALSE;}. This is not allowing me to come in edit mode...
iPhoneDev
+2  A: 

Is working

  • (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

{

return UITableViewCellEditingStyleNone;

}

But not able to align table section. If we hide the "-" button still the space remain same. Can any one help to make table section left align

iPhoneDev
A: 

Here is my complete solution, without indentation (0left align) of the cell!

  • (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; }

  • (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ return UITableViewCellEditingStyleNone; }

  • (BOOL)tableView:(UITableView *)tableview shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { return NO; }

  • (BOOL)tableView:(UITableView *)tableview canMoveRowAtIndexPath:(NSIndexPath *)indexPath { return YES; }

Stefan von Chossy