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
views:
26answers:
1
Q:
i want to show textfield data in tableviewcell which replace the existance data on cell in iphone ?
A:
- 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
2010-07-08 08:44:14
hi toncloni never ever use of custom protocol so plz more describe becoz i can't get o/p
suchita
2010-07-12 08:48:19
take a look at this question: http://stackoverflow.com/questions/645449/how-to-use-custom-delegates-in-objective-c
tonklon
2010-07-12 11:12: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
suchita
2010-07-14 10:01:08