i want to show textfield data in tableviewcell which replace the existance data on cell in iphone?
In my application i hve tableview开发者_如何学JAVAcontroller and its detailviewcontroller(dvc). dvc contains textfield and button.I actually want when i clicked on button textfield text is replaced the tableview cell text.what can i do ? explain in detail
- Define a delegate protocol, that contains the method - (void)textHasChangedTo:(NSString*)text
- Make tableviewcontroller conforming to this protocol.
- Implement
- (void)textHasChangedTo:(NSString*)text
on tableviewcontroller, so that it changes the text in the cell. For Example change the text in your model and let the tableView reloadData. - Define a delegate property on dvc.
- Set the delegate of dvc to tableviewcontroller before pushing the dvc onto the navigation stack.
- In the button action, call textHasChangedTo: on the delegate with the new text.
精彩评论