views:

26

answers:

1

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

A: 
  1. Define a delegate protocol, that contains the method - (void)textHasChangedTo:(NSString*)text
  2. Make tableviewcontroller conforming to this protocol.
  3. 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.
  4. Define a delegate property on dvc.
  5. Set the delegate of dvc to tableviewcontroller before pushing the dvc onto the navigation stack.
  6. In the button action, call textHasChangedTo: on the delegate with the new text.
tonklon
hi toncloni never ever use of custom protocol so plz more describe becoz i can't get o/p
suchita
take a look at this question: http://stackoverflow.com/questions/645449/how-to-use-custom-delegates-in-objective-c
tonklon
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