开发者社区> 问答> 正文

怎样取消UITableViewCell的选中状态?

点击Cell是被选中的cell的背景会是灰色的,怎样取消Cell 的选中状态?

展开
收起
a123456678 2016-07-28 11:32:10 1954 0
1 条回答
写回答
取消 提交回答
  • 只需要在- (void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath )indexPath中加入一行代码就可以了[tableView deselectRowAtIndexPath:indexPath animated:YES]; 然后再写你其他代码就可以了

    • (void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath )indexPath
      {

      [tableView deselectRowAtIndexPath:indexPath animated:YES];// 取消选中
      //其他代码

      }

    2019-07-17 20:01:15
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载