I'm working on an iOS application that uses a very common Core Data based tabular view to display items, and when selected, it shows a more detailed view, similar to the Contacts application. The detail view is a generated programmatically grouped table with a custom (defined by nib) view for the header, which has an image and a name. Some of the cells in the table are user cells that have a label name and a text field value. In edit mode, the editable table cells (and the name in the header) have .clearButtonMode set to UITextFieldViewModeAlways to indicate that they are editable.
I am currently using the same view controller to display detailed information, edit information, and add a new record to the original list.
When a new item is added, the view controller is created using a special init reload, which sets a flag in the view controller to indicate that it is adding a record. This allows it to start in edit mode, and if the edit mode remains, the model view disappears. The right menu button is the usual Edit / Done, and the left is the cancel button. When an existing item is edited, the left button (normal back button) is replaced by the cancel button.
I'm starting to wonder if there is a way to control one controller in three different modes. There are several issues that I'm not sure how to handle.
1) How do I know if editing mode is left by clicking Finish? Is there any action for this? If the cancellation is deleted, the action either cancels itself (add mode) or restores the previous values, exits the editing mode. I suppose I could put a check in my setEditing override to handle it, but there seems to be a better way.
2) When edit mode is entered and I set editable text fields to UITextFieldViewModeAlways, is there any way to animate the appearance of the “X” buttons so that they disappear with the edit indicators on regular cells?
3--1 - ? , , .
Jorj
user253667