user810606
user810606

Reputation:

How do I save text from a UITextField in a UITableViewCell?

I have a sectioned table with dynamic number of rows per section. In each cell there is a text field. I need some advice or a nudge in the right direction for: saving text input in the text field after editing is done into a NSMutableArray. .

Upvotes: 0

Views: 331

Answers (1)

Deepak Danduprolu
Deepak Danduprolu

Reputation: 44633

I am assuming you are setting the table view controller as the text field's delegate somewhere. Based on the comment, you can identify the cell the text field belongs to using,

- (void)textFieldDidEndEditing:(UITextField *)textField {
    YourCustomCell * cell = (YourCustomCell *)textField.superview.superview;
    NSIndexPath * indexPath = [self.tableView indexPathForCell:cell];

    /* Use the index path to store the data in array or dictionary with the index path as key */
}

Upvotes: 1

Related Questions