Adam S.
Adam S.

Reputation: 1271

How to stop tableview from indenting on edit while still having add/delete buttons?

I have a uitableview and when I press the edit button associated with it I do not want to have the cells indent but I still want the add/delete buttons to be inserted. When I have tableView:shouldIndentWhileEditingRowAtIndexPath return NO the cells still indent unless I have editingStyleForRowAtIndexPath return UITableViewCellEditingStyleNone. What is the easiest way to go about this? Thanks

Upvotes: 4

Views: 1840

Answers (2)

Simon
Simon

Reputation: 25984

I haven't found a solution, but I can explain why tableView:shouldIndentWhileEditingRowAtIndexPath: isn't working. According to the comments on it:

// This method only applies to grouped style table views.

Upvotes: 0

user253667
user253667

Reputation:

I was watching "Session 432 - Mastering iPhone Table Views" from the Apple Developer - iPhone Development Foundation Videos session and at about 5:15 into it, they talk about

-(BOOL)tableView:(UITableView*)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath*)indexPath;

They even have images with the red deletable icon on the left (they appear inside the cell).

Unless they changed this in recent iOS releases, this should work.

I do want to thank you for mentioning tableView:shouldIndentWhileEditingRowAtIndexPath because it solved a problem I was having! :)

jorj

Upvotes: 3

Related Questions