Disable text selection UITextView

前端 未结 3 2015
攒了一身酷
攒了一身酷 2021-01-17 01:48

I want to disable text selection on a UITextView. Until now what i\'ve already done is:

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {   
           


        
3条回答
  •  迷失自我
    2021-01-17 02:41

    If you want to prevent the text selection but keep links interactions, add the following textview delegate methods

    - (void)textViewDidChangeSelection:(UITextView *)textView
    {
        [textView setSelectedRange:NSMakeRange(NSNotFound, 0)];
    }
    

提交回复
热议问题