两个导航视图之间 UITextView 的内容处理 [英] content handling of UITextView between two navigation view

查看:25
本文介绍了两个导航视图之间 UITextView 的内容处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看有一个表格单元格和一个保存按钮.

I have view a that has a table cell and a save button.

如果我触摸表格单元格,一个新的导航视图会滑入(视图 b).在视图 b 中,我有一个 UITextView,我可以在其中键入需要保存的所有上下文.当然,视图 b"的左上角有后退"按钮.

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' 有一个保存按钮,它想从我输入的 'view b' 中保存 textView 的内容.保存是在 'view a' 而不是 'view b' 上完成的,因为实际上还有其他信息需要也保存在视图 a"中.

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

要做到这一点,当我在view b"的 textView 中输入完内容并返回到view a"(后退按钮或完成按钮)时,应该传递文本视图中的内容而不是蒸发以某种方式返回到查看 a",以便在我按下保存按钮时保存.

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

目前我在想..??= self.textView.text;at viewWillDisappear in 'view b'

so far I'm thinking of.. ?? = self.textView.text; at viewWillDisappear in 'view b'

非常感谢.

推荐答案

使用 TextView 的委托,并在完成编辑后将其数据保存到 dalegete 类的字符串变量然后将其从类 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

这里是委托方法

- (void)textViewDidEndEditing:(UITextView *)textView 

{

     delegateObject.string=textView.text;
     //save to delegate class's string 

}

确保你首先初始化了委托类的字符串...

make sure you first initialized the string of delegate class...

这篇关于两个导航视图之间 UITextView 的内容处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆