您的位置:首页 > 运维架构

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

2016-11-02 12:05 459 查看
将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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐