I have a tableview with one UITextView
per cell... I have plain text inside this UITextViews, but somehow link parsing (enabled via Interface Builder) seems broken: links are not parsed as links and plain text is clickable and points to the link in the previous cells (check last cell in the screenshot: it's not an URL but it's pointing to the twitter link)...
My code for the tableview population is pretty straightforward...
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"ItemCell";
NSString *itemText;
CpCpListCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CpCpListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (theTableView == self.searchDisplayController.searchResultsTableView) {
itemText = [self.filteredArray objectAtIndex:indexPath.row];
} else {
itemText = [self.items objectAtIndex:indexPath.row];
}
[cell.cellContent setText:nil];
[cell.cellContent setText:itemText];
int len = cell.cellContent.text.length;
NSString *labelValue = [NSString stringWithFormat:@"%@: %d",NSLocalizedString(@"CHARCOUNT", nil),len];
[cell.charCount setText:labelValue];
UITapGestureRecognizer *rowClick = [[UITapGestureRecognizer alloc] initWithTarget:cell action:@selector(handleCellClick)];
//modify this number to recognizer number of tap
[rowClick setNumberOfTapsRequired:1];
[cell.cellContent addGestureRecognizer:rowClick];
[cell.cellContent setSelectable: YES];
cell.root = self;
return cell;
}
I see these logs in XCode...
Bad result <Result:HttpURL:{0, 394}>: its range {0, 394} is not completely included in the range {0, 134} of the string it is attached to, Vengono {
DDResultAttributeName = "<Result:HttpURL:{0, 394}>";
NSFont = "<UICTFont: 0x155eb2a0> font-family: \"Helvetica\"; font-weight: normal; font-style: normal; font-size: 12.00pt";
NSLink = "http://google.it";
}200 euro{
DDResultAttributeName = "<Result:Money:{8, 8}>";
NSFont = "<UICTFont: 0x155eb2a0> font-family: \"Helvetica\"; font-weight: normal; font-style: normal; font-size: 12.00pt";
NSLink = "http://google.it";
} l'uno + 30 di spedizione, 200 se vieni a prenderteli a milano. Sono biglietti prato dx blu x il 29. Ormai introvabili{
DDResultAttributeName = "<Result:HttpURL:{0, 394}>";
NSFont = "<UICTFont: 0x155eb2a0> font-family: \"Helvetica\"; font-weight: normal; font-style: normal; font-size: 12.00pt";
NSLink = "http://google.it";
}