简体   繁体   中英

Save UITextView content in NSString

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM