问题描述:

I want to make a grouped TableView similar to the Apple iPhone contacts application.

I need a lot of standard fields which can be edited, but I would only like them editable once the edit button in the navbar is clicked.

This has been bothering me forever that I could not find a good tutorial.

Thanks in advance.

网友答案:

This is not easy. I just built the same thing because there is nothing available from Apple. I ended up creating a single table cell with a UILabel and a UIView on it. The UILabel is for when the cell is in read mode, and the UIView is for editing. The UIView contains a number of UITextFields. These are the individual fields. I also had to implement drawing code to draw the lines between the fields. Then I had to come up with the code to pass in an address object, load it into the fields, format the text for the label, switch in and out of editing mode (with animation), and finally handling saving of changes and canceling. As yet it doesn't handle tapping the address type to select that from a popup list, but I have most of the code in place for the rest.

This could have been done using individual table view cells for each field. But then you can't select the whole thing the way it does in contacts and adding and deleting addresses becomes trickier.

相关阅读:
Top