UITextView disabling text selection

后端 未结 11 1115
误落风尘
误落风尘 2020-12-08 00:19

I\'m having a hard time getting the UITextView to disable the selecting of the text.

I\'ve tried:

canCancelContentTouches = YES;
         


        
11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 00:55

    If you just want to prevent it from being edited, then set the UITextView's "editable" property to NO/False.

    If you're trying to leave it editable but not selectable, that's going to be tricky. You might need to create a hidden textview that the user can type into and then have UITextView observe that hidden textview and populate itself with the textview's text.

提交回复
热议问题