简体   繁体   English

Swift - TableView单元格选择

[英]Swift - TableView Cell Selection

I make in Swift a UITableview , and I want make that when somebody click on the cell he will be show a selection of this cell and when somebody click on the next cell the selection disappear from first selection and show in the next selection. 我在Swift中创建了一个UITableview ,我希望当有人点击单元格时,他会显示这个单元格的选择,当有人点击下一个单元格时,选择将从第一个选择中消失并显示在下一个选择中。

Example: I click on Cell1 - show now selection of this cell, When I click on Cell2 the Cell1 selection disappear and Cell2 show now selection. 例如:我点击小区1 -显示现在选择这个小区的,当我点击小区2 小区1选择消失, 小区2现在显示的选择。

Hope somebody can help me 希望有人可以帮助我

Usethe didSelectRowAtIndexPath method and access the cell from it: 使用didSelectRowAtIndexPath方法并从中访问单元格:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM