点击tableView中的cell并返回时,怎么取消它的选择状态

2025-04-13 09:44:45
推荐回答(2个)
回答1:

在UITableView里面,选择了某一个cell以后,点击立刻取消该cell的选中状态,可以使用如下方法:\x0d\x0a\x0d\x0a-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath\x0d\x0a{\x0d\x0a//somefunctions\x0d\x0a......\x0d\x0a\x0d\x0a//取消选中状态\x0d\x0a[tableViewdeselectRowAtIndexPath:indexPathanimated:NO];\x0d\x0a}

回答2:

UITableView面选择某cell点击立刻取消该cell选状态使用:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//some functions
......

// 取消选状态
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}