i use some code for inline cell editing from Apples TaggedLocations Example and im now stuck.
At the demo Code they save the changes at textFieldDidEndEditing, this works because they asume to edit only the first element in a table view.
I have to edit every row at the table view, so my problem is how to get indexPath.row to up开发者_开发知识库date the correct object stored in a mutableArray.
Or did i miss something?
Thanks for your help!
One way is when you add the text field to the cell in cellForRowAtIndexPath, set its tag property to indexPath.row. Then in textFieldDidEndEditing, get the row using textField.tag.
The textField variable in the delegation method textFieldDidEndEditing shows you which text field is being edited by the user. By using this variable, you are updating value for what the user is changing.
- (void)textFieldDidEndEditing:(UITextField *)textField
If the user is updating one row, and you want to modify all other rows, then it is a strange UI design.
In case you want to mass update all the values in the table rows, change the values from the datasource and then update the changes on the table views.
精彩评论