I am working in an iPhone project, and I have a UITableView where each cell has a UITextField to edit the information. The problem is, if a touch the TextField the Keyboard will be shown and if a click on back button of navigation controller, I need to resign the keyboard and save the new information. My idea was to save in a NSMutableDictionary the PlaceHolder of the textfield as key and value is the indexPath of it. I have another NSMutableDictionary where I save as key the UITextField and Value IndexPath. The reason to do this is, that the method textFieldDidEndEdition receive UITextField as parameter and I need to know what field was pressed to 开发者_运维技巧update my database.
I hope to be clear. Thanks
Could you use Key Value Observing (KVO) on the text
property of UITextField
to automatically update your model when it's value changes?
See Apple's Key Value Observing Programming Guide for more information.
精彩评论