I have view a that has a table cell and a sav开发者_如何学运维e button.
If I touch the table cell, a new navigation view slides in (view b). In the view b, I have one UITextView where I type all the context I need save. And of course there is 'back' button on the top left side of the 'view b'.
'view a' has a save button, it wants save content of the textView from 'view b' that I typed in. Saving is done on 'view a' not 'view b' since actually there are other information need to be saved on 'view a' as well.
To do that, when I finish typing something into the textView of 'view b' and come back to 'view a'(back button or done button), instead of get vaporized, the content in the text view should be delivered somehow back to the ' view a' so as to be saved when I press save button.
how should I do? ( I spent almost a whole day to figure this out..)
so far I'm thinking of.. ?? = self.textView.text; at viewWillDisappear in 'view b'
many thanks.
use delegates of TextView and save its data just when it finished editing to dalegete class's string variable and then save it from class 1
here is the delegate method
- (void)textViewDidEndEditing:(UITextView *)textView
{
delegateObject.string=textView.text;
//save to delegate class's string
}
make sure you first initialized the string of delegate class...
精彩评论