UITextView insert text in the textview text

后端 未结 6 1021
谎友^
谎友^ 2020-12-10 03:16

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 ne

6条回答
  •  旧时难觅i
    2020-12-10 03:33

    This is a correct answer!

    The cursor position is also right.

    A scroll position is also right.

    - (void) insertString: (NSString *) insertingString intoTextView: (UITextView *) textView
    {
        [textView replaceRange:textView.selectedTextRange withText:insertingString];
    }
    

提交回复
热议问题