Quebra de detecção de link do iOS 7 UITextView no UITableView
Eu tenho um costumeUITableView
célula criada na minhaUITableView
como isso:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"CELL_IDENTIFIER";
SGCustomCell *cell = (SGCustomCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) cell = [[SGCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
cell = [self customizedCell:cell withPost:[postsArray objectAtIndex:indexPath.row]];
return cell;
}
Eu configurei o celular assim (definindoUITextView.text
paranil
- como observado emesta resposta):
descriptionLabel.text = nil;
descriptionLabel.text = post.postDescription;
descriptionLabel.frame = CGRectMake(leftMargin - 4, currentTitleLabel.frame.origin.y + currentTitleLabel.frame.size.height + 10, self.frame.size.width - topMargin * 3, 100);
[descriptionLabel sizeToFit];
As células são 100% reutilizáveis eUITextView
é assim (como você vê, nada de especial):
descriptionLabel = [[UITextView alloc] init];
descriptionLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:11];
descriptionLabel.editable = NO;
descriptionLabel.scrollEnabled = NO;
descriptionLabel.dataDetectorTypes = UIDataDetectorTypeLink;
descriptionLabel.frame = CGRectMake(leftMargin, currentTitleLabel.frame.origin.y + currentTitleLabel.frame.size.height + 10, self.frame.size.width - topMargin * 3, 10);
[self addSubview:descriptionLabel];
Mas quando a mesa tem cerca de 50 células e quando eurolar rápido Eu recebo o seguinte acidente:
Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'
O que é absolutamente ridículo - eu comento esta linha -descriptionLabel.dataDetectorTypes = UIDataDetectorTypeLink;
e o aplicativo pára de funcionar! Passei horas tentando descobrir qual era o problema e agora simplesmente recebo isso.
Testado no iOS 7.0.3