I’ve a UITableViewController which has Edit/Save and cancel buttons. At present I’m displaying 5 row’s of custom UITableViewCell’s. Custom UITableViewCell contains textfield and label. Let’s say if user enters text in 1st table cell and hits “Save” then I’m losing the entered/modified text. Whereas if user hits return key after entering/modifying text then the entered/modified value is captured via:
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
.......code exists to capture value here
}
but on the other hand if user hits “Save” button without returning the textfield then I’m losing the entered/modified value. What’s the best way to capture user’s input here:
a) when user returns text field –> which I’m doing already
b) when user hits save button without returning textfield/textview –> ????
thanks in advance,
Rama
You could keep a property that holds the string as it’s being entered using a delegate method. Something like:
Another option might be to call [tableView endEditing] as the first thing to do on a save but I’m not certain that fires the textFieldShouldEndEditing: notification.