In my application i hve tableviewcontroller 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
Asked
Active
Viewed 216 times
1 Answers
0
- 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.

tonklon
- 6,777
- 2
- 30
- 36
-
hi tonclon i never ever use of custom protocol so plz more describe becoz i can't get o/p – iOS_User Jul 12 '10 at 08:48
-
take a look at this question: http://stackoverflow.com/questions/645449/how-to-use-custom-delegates-in-objective-c – tonklon Jul 12 '10 at 11:12
-
Hi tonclon how to change the particular cell content from textfield's text becoz i can't set the data what the way to do this plz explain in detail – iOS_User Jul 14 '10 at 10:01