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

来源:互联网 发布:淘宝无线套餐链接转换 编辑:程序博客网 时间:2024/06/05 03:29

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

而UIViewController没有,因此要手动取消选中的状态。


解决方法:

在viewWillAppear方法中加入:

[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];






0 0
原创粉丝点击