将tableview添加进viewController以后,会产生一个问题,当点击cell push到另个viewController以后再返回时,cell的状态还是为选中状态。因为UITableViewController有一个clearsSelectionOnViewWillAppear的property,
而UIViewController没有,因此要手动取消选中的状态。
解决方法:
在viewWillAppear方法中加入:
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];