我试图实现一个'设置页面'的分隔视图,左侧为一个表视图,右侧为一个图像视图。一切都很好,但如果尝试更快地点击它,则表格视图单元格触摸会出现延迟。 DidSelectRowAtIndex
路径没有被调用,但单元格闪烁。UITableViewCell触摸响应的延迟
我已经试过,
移动影像变更逻辑为
willSelectRowAtIndexPath
从DidSelectRowAtIndex
去除一切从委托方法(来检查它是否是由于图像的加载 )
我该如何解决这条线问题?
TableDatasource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"tutorialCell";
CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"TutorialTableCell" owner:nil options:nil];
cell = [nib objectAtIndex:0];
}
NSDictionary * dic = [dictArray objectAtIndex:indexPath.row];
cell.tutorialText.text = [dic valueForKey:TUTORIAL_TEXT];
cell.tutorialImage.image = [UIImage imageNamed:[dic valueForKey:TUTORIAL_ICON]];
cell.contentView.backgroundColor = [UIColor colorWithHex:@"#36393D" alpha:1.0];
UIView *bgColorView = [[UIView alloc] init];
[bgColorView setBackgroundColor:[UIColor colorWithHex:@"#1f1f1f" alpha:1.0]];
[cell setSelectedBackgroundView:bgColorView];
return cell;
}
的TableView委托
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary * dic = [dictArray objectAtIndex:indexPath.row];
_tutorialImageView.image = [UIImage imageNamed:[dic valueForKey:TUTORIAL_IMAGE]];
}
它已被设置为否在界面生成器中,我甚至试图把它放在'viewdidload'中,但行为没有变化。 – 2013-03-25 06:38:57
@Clement好的,编辑中的新建议。另外,你有没有尝试用仪器分析这个代码?如果它确实是一个性能问题,它将有助于了解最重的回溯。 – 2013-03-25 06:51:09
谢谢。我尝试了你的建议 – 2013-03-25 07:14:13