简体   繁体   中英

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.

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.

Hope somebody can help me

Usethe didSelectRowAtIndexPath method and access the cell from it:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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