我試圖實現一個'設置頁面'的分隔視圖,左側爲一個表視圖,右側爲一個圖像視圖。一切都很好,但如果嘗試更快地點擊它,則表格視圖單元格觸摸會出現延遲。 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