views:

361

answers:

2

Hi, I'm trying to save the contents of an UITextView into a NSString which I will somehow persist later.

The problem is that the UITextView "text" property doesn't save all the rows in the textView (after touching "return"). I tried print the TextView object and the textView.text, and they're different.

Does anybody know how (after editing the textView) I can save its content into a String (or something else that I can later access and share through different views and persist in the database)?

Thanks a lot. Pretty sure it is simple, but I'm honestly not finding the solution.

A: 
NSString *textViewString = myTextView.text

ought to be what you need. But you say that the TextView object and its text property have different values? Has your delegate received – textViewDidEndEditing: or – textViewDidChange: yet?

cdespinosa
Yes, my delegate receives those values, in fact while printing (NSLOG) in the textViewDidChange method, I find that the values are correct. After editing, however, I save those values to a NSString, which I try to access in another view controller (the root). It works if I never hit "Return" while editing the text, and it doesn't work otherwise. Not giving up though. It must be a stupid mistake...
camilo
A: 

I found what I needed. Thanks for the answer cdespinosa anyway.

I leave the url here, maybe it helps others...

http://www.raddonline.com/blogs/geek-journal/iphone-sdk-using-a-uitableviewcell-with-a-uitextview-for-entering-text-part-1-of-2/

Cheers!

camilo