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

2025-04-18 08:16:47
推荐回答(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:

试试 [tableView deselectRowAtIndexPath:indexpath animated:YES];