【问题标题】:Hide grey color when cell is touched触摸单元格时隐藏灰色
【发布时间】:2017-10-14 12:02:21
【问题描述】:

我正在制作一个像这样具有多个单元格选择(我使用复选标记)的应用

问题是当我点击一个单元格时,它仍然是灰色的,非常糟糕。我该如何解决?

【问题讨论】:

    标签: objective-c xcode uitableview


    【解决方案1】:

    如果您根本不想显示灰色选择:

    • 在情节提要中选择UITableViewCell
    • 在 Inspector 中,将 selected 设置为 none

    您可以找到更多选项以编程方式设置它in this answer

    【讨论】:

      【解决方案2】:

      didSelectRowAt#试试这个代码

      cell.selectionStyle = UITableViewCellSelectionStyleNone
      

      【讨论】:

        【解决方案3】:

        你可以用这个:

        func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
            tableView.deselectRowAtIndexPath(indexPath, animated: true)
        }
        

        cell.selectionStyle = UITableViewCellSelectionStyle.None
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2014-04-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多