我正在做一个简单的“添加到收藏夹”功能,这是一个UITableViewController。当用户选择的单元,I设置灰色color
和太禁用selectionStyle
iOS - tableview禁用滚动时刷新
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.textLabel.textColor = [UIColor grayColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
我的第一个问题是,每次我被选择小区,其他一些细胞转换的彩色。所以我删除了使这不会发生下面的代码:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
但我仍然有一个奇怪的问题:向下滚动tableview中,然后回到它的顶部后,我注意到,所有的细胞我已选择返回到默认颜色,并且选中的最后一个单元以蓝色突出显示。
所以我也许错了,但我假定该滚动时的tableview令人耳目一新,我想禁用此行为。
在此先感谢您的帮助。
此解决方案适用于我,非常感谢! – Yaman