什么会导致表格视图单元格在被触摸后保持高亮显示?我单击该单元格,可以看到它在按下详细视图时保持高亮显示。弹出详细视图后,该单元格仍会突出显示。
发布于 2009-12-03 23:43:01
在您的didSelectRowAtIndexPath
中,您需要调用deselectRowAtIndexPath
来取消选择单元格。
所以,无论你在didSelectRowAtIndexPath
中做什么,你也可以让它调用deselectRowAtIndexPath
。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Do some stuff when the row is selected
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
发布于 2016-03-18 11:59:53
对于Swift用户,将以下代码添加到您的代码中:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
这是paulthenerd的答案,但用Swift而不是Obj-C。
发布于 2010-01-08 21:41:08
你继承了-(void)viewWillAppear:(BOOL)animated
吗?当您不在自定义方法中调用UITableViewCell时,选定的[super viewWillAppear:animated];
将不会取消选择。
https://stackoverflow.com/questions/1840614
复制相似问题