iOS 7 UITextView link detection crash in UITableView

前端 未结 3 2017
梦毁少年i
梦毁少年i 2020-12-31 11:26

I have a custom UITableView cell set up in my UITableView like this:

- (UITableViewCell *)tableView:(UITableView *)tableView cellFo         


        
3条回答
  •  离开以前
    2020-12-31 12:17

    I could reproduce your crash. Implementing the following method within the TableViewCell subclass

    - (void)prepareForReuse
    {
        [super prepareForReuse];
        [descriptionLabel setDataDetectorTypes: UIDataDetectorTypeNone];
    }
    

    and add following call within - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath before setting the text:

    [descriptionLabel setDataDetectorTypes: UIDataDetectorTypeLink];
    

    worked for me. Maybe it cancels ongoing drawing inside the textview and is avoiding the crash that way.

    edit: Calling [descriptionLabel setDataDetectorTypes: UIDataDetectorTypeNone]; and [descriptionLabel setDataDetectorTypes: UIDataDetectorTypeLink]; just before setting the text also seems to fix the crash

提交回复
热议问题