Luther Baker
Luther Baker

Reputation: 7341

Selecting a UITableViewCell in Edit mode

If I create a UITableViewController - drilling down works as expected. If a user selects a cell and I implement 'didSelectRowAtIndexPath', the cell flashes blue and the next view shows up.

But, if I include an 'edit' button (self.navigationItem.rightBarButtonItem = self.editButtonItem), when the user clicks 'Edit' - the mode correctly changes (all the cells indent and paint an appropriate editingAccessory), ... BUT, the cells are no long 'selectable'.

IE: while in edit mode, when a user selects a cell, nothing is happening. No blue flash. No invocation of 'didSelectRowAtIndexPath', nothing.

When I open the iPhone example 'iPhoneCoreDataRecipes' (as provided in the SDK docs), sure enough, they have a RecipeDetailViewController - that, when put into edit mode, still allows you to drill down. I've downloaded and built their example and it works just fine. I can't seem to find any trickery in their code to enable this 'selectable cell when in edit mode behavior' but I'm just not getting it when I do it.

Thoughts?

Thanks for any time,

-Luther

Upvotes: 29

Views: 11370

Answers (3)

avdyushin
avdyushin

Reputation: 1946

It can be changed in Storyboard:

enter image description here

Upvotes: 3

Giorgio
Giorgio

Reputation: 2200

You have to set the allowsSelectionDuringEditing property of UITableView to YES.

The default value is NO.

Upvotes: 4

NWCoder
NWCoder

Reputation: 5266

UITableView has a property allowsSelectionDuringEditing for this.

IMHO it should have been YES by default.

Upvotes: 64

Related Questions