关于viewController中的tableview的cell在pop回来后仍有选中效果的解决方法

来源:互联网 发布:辩论电视网络 编辑:程序博客网 时间:2024/05/29 03:09

将tableview添加进viewController以后,会产生一个问题,当点击cell push到另个viewController以后再返回时,cell的状态还是为选中状态。因为UITableViewController有一个clearsSelectionOnViewWillAppear的property,
而UIViewController没有,因此要手动取消选中的状态。

解决方法:
在viewWillAppear方法中加入:

[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];  
转自:http://blog.csdn.net/emotionv/article/details/50267989
0 0