UITextViews in a UITableView link detection bug in iOS 7

后端 未结 13 719
醉梦人生
醉梦人生 2020-12-01 07:19

I have custom UITableViewCells that contain a UITextView. I have link detection in the UITextView turned on in Interface Builder. When I first load the table view, everythin

相关标签:
13条回答
  • 2020-12-01 07:43

    This one works reliably for me:

    // fix url detection bug
    cell.textView.dataDetectorTypes = UIDataDetectorTypeNone;
    cell.textView.dataDetectorTypes = UIDataDetectorTypeLink;
    
    0 讨论(0)
  • 2020-12-01 07:45

    Changing the Tint color to other color actually works. However if selectable enable the tint will also be the same color.

    0 讨论(0)
  • 2020-12-01 07:45

    I also face this problem and I found out to solve this is to set textview properties in the following order,

    [textview setDataDetectorTypes:UIDataDetectorTypeNone ];
    textView.editable = NO;
    [textView setDataDetectorTypes:UIDataDetectorTypeLink];
    textView.text=@"The text you need to show with link";
    

    Hope this help you.....

    0 讨论(0)
  • 2020-12-01 07:48

    You can fix this issue by using NSAttributedString.

    cell.textview.attributedText = [[NSAttributedString alloc] initWithString:message.message];
    
    0 讨论(0)
  • 2020-12-01 07:49

    Several suggestions here and through links provided did not help me with this bug.

    I tried setting attributed text, setting text to nil, setting text to @"".

    In the end forcing the text view in an out of editable mode did the trick. In prepare for reuse

    - (void)prepareForReuse
    {
      ...
        textView.editable = YES;
        textView.editable = NO;
      ...
    }
    
    0 讨论(0)
  • 2020-12-01 07:50
    textView.text = nil;
    textView.attributedText = nil;
    
    textView.attributedText = [[NSAttributedString alloc] initWithString:@"your new string"];
    
    0 讨论(0)
提交回复
热议问题