1
我有一个tableview与一个UITextView
每个单元格...我有这个UITextViews内的纯文本,但不知何故链接解析(通过接口生成器启用)似乎打破:链接不被解析为链接和纯文本是可点击的,并指向在前面的细胞链接(查看最后一个单元格中的截图:它不是一个URL,但它指向Twitter的链接)...UITextView链接解析错误...为什么?
我的实现代码如下人口代码是非常简单的...
- (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;
}
我看到SE日志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";
}