content handling of UITextView between two navigation view

喜夏-厌秋 提交于 2019-12-12 04:04:08

问题


I have view a that has a table cell and a save 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.


回答1:


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...



来源:https://stackoverflow.com/questions/3940575/content-handling-of-uitextview-between-two-navigation-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!