为什么UITableViewCell仍然突出显示? [英] Why does UITableViewCell remain highlighted?

查看:59
本文介绍了为什么UITableViewCell仍然突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么会导致表格视图单元格在被触​​摸后仍保持突出显示状态?我单击该单元格,可以看到在按下详细视图时它保持突出显示状态。弹出详细视图后,该单元格仍会突出显示。

What would cause a table view cell to remain highlighted after being touched? I click the cell and can see it stays highlighted as a detail view is pushed. Once the detail view is popped, the cell is still highlighted.

推荐答案

在您的 didSelectRowAtIndexPath 您需要调用 deselectRowAtIndexPath 取消选择单元格。

In your didSelectRowAtIndexPath you need to call deselectRowAtIndexPath to deselect the cell.

所以您在 didSelectRowAtIndexPath 您也可以调用 deselectRowAtIndexPath

So whatever else you are doing in didSelectRowAtIndexPath you just have it call deselectRowAtIndexPath as well.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 // Do some stuff when the row is selected
 [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

这篇关于为什么UITableViewCell仍然突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆