I want to have to occasionally insert text into the UITextView text object. For example, if the user presses the "New Paragraph" button I would like to insert a double newline instead of just the standard single newline.
How can I go about such? Do i have to read the string from UITextView, mutate it, and write it back? Then how would I know where the pointer was?
Thanks
Since the text
property of UITextView
is immutable, you have to create a new string and set the text property to it. NSString has an instance method (-stringByAppendingString:
) for creating a new string by appending the argument to the receiver:
textView.text = [textView.text stringByAppendingString:@"\n\n"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With