How do I prevent my table cell's textview from being editable after editing is done?

Posted by Gorgando on Stack Overflow See other posts from Stack Overflow or by Gorgando
Published on 2010-05-18T22:30:59Z Indexed on 2010/05/18 23:10 UTC
Read the original article Hit count: 151

So this is an interesting problem. I have custom tableviewcells that include a text field. When In my cellForRowAtIndexPath I have an if statement that determines whether or not the cell's text field should be editable- it looks like this:

(self.isEditing) ? [infoCell.textField setEnabled:YES] : [infoCell.textField setEnabled:NO];

This actually works well - except for the issue I'm having. It makes it so that when the tableview is displayed, the rows' text field cannot be edited. When the user clicks "Edit" to put it into editing mode, then the text fields are enabled for editing.

The Problem: When I am editing a field, and click "Done", it goes back to the regular tableview but the keyboard stays visible and the last cell's text field I was editing continues to be editable.

What Should happen: The keyboard should go away and all the cells' text fields should no longer be editable.

Any ideas about what could be going wrong? Things to look for?

Thanks!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitableview