UITableViewCell editing mode, for example, a contact application

I am currently working on an application where the user must edit his profile. I would like to use the editing mode, as in the application for contacts. (Labels become text fields)

Is there an easy way to achieve this? Or do I need to replace cell.detailTextLabel.text with uitextfield myself?

Example of viewing an application for editing applications: http://content.screencast.com/users/EricMulder/folders/Jing/media/0839c0c9-43df-4283-bcf1-65f49b43696f/00000047.png

+4
source share
2 answers

For anyone interested, here is a sample code to add a UITextField to your cell:

cell.textLabel.text = NSLocalizedString(@"nameLabel", @""); //add textField if(![cell viewWithTag:101]) { UITextField *aliasField = [[UITextField alloc] initWithFrame:CGRectMake(93, 13, 225, 44)]; aliasField.text = @"Eric Mulder"; aliasField.font = [UIFont boldSystemFontOfSize:15.0f]; aliasField.tag = 101; [cell addSubview:aliasField]; } cell.detailTextLabel.text = nil; 
+2
source

ejazz

Why do you think these are shortcuts ?; )

You can create a custom cell with a UITextField in the interface builder. Download it from xib. And change the textfields editable property in your implementation of the setEditing: animated: method of your view controller.

0
source

All Articles