问题:
1、UITextTable的Cell一旦被选中后就不能自动取消选中状态,那么需要手动进行一些处理
思路:
1、其实UITableView中有下面这个函数,但是这个方法不能被代理方法调用,所以在列表被选中后不会调用该方法
- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
2、另外一个思路是通过下面这个代理函数,搭配一个取消选中的函数即可实现延迟取消Cell的选中状态
源码:(当Cell被选中后,代理方法调用didSelectRowAtIndexPath , 然后代理方法0.1s后调用一个Cell取消选中的代理函数即可实现)
// 选中状态的延迟0.1s后取消选中 - (void)deselect:(id)sender { [_tableView deselectRowAtIndexPath:[_tableView indexPathForSelectedRow] animated:YES]; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self performSelector:@selector(deselect:) withObject:nil afterDelay:0.1f]; }