【问题标题】:Swift - TableView Cell SelectionSwift - TableView 单元格选择
【发布时间】:2015-04-20 23:42:02
【问题描述】:

我在 Swift 中创建了一个 UITableview,我希望当有人单击单元格时,他将显示该单元格的选择,当有人单击下一个单元格时,选择会从第一个选择中消失并显示在下一个选择。

示例:我点击 Cell1 - 现在显示该单元格的选择,当我点击 Cell2 时,Cell1 选择消失并且 Cell2 现在显示选择。

希望有人可以帮助我

【问题讨论】:

  • 这不是tableview的默认行为吗?

标签: swift tableview selection cell


【解决方案1】:

使用didSelectRowAtIndexPath 方法并从中访问单元格:

func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
  //Do whatever you want with the cell
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 2016-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多