Hello friendsI have this code:func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> Cell {
let cell = tableViewFriends.dequeueReusableCellWithIdentifier("Cell") as! Cell;
var name: String = dataFriends[indexPath.row]["name_friend"] as! String
cell.lblFriendName?.text = name.capitalizedString
cell.imgFriend.image = UIImage(named: "homer.jpg")
cell.imgRadio.image = UIImage(named: "radio-unselected")
return cell;
}
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
let cell:Cell = tableView.cellForRowAtIndexPath(indexPath) as! Cell
cell.imgRadio.image = UIImage(named: "radio-selected")
cell.backgroundColor = UIColor.redColor()
NSLog("You selected cell number: \(indexPath.row)!")
}
func tableView(tableView: UITableView!, didDeselectRowAtIndexPath indexPath: NSIndexPath!) {
let cell:Cell = tableView.cellForRowAtIndexPath(indexPath) as! Cell
cell.imgRadio.image = UIImage(named: "radio-unselected")
cell.backgroundColor = UIColor.whiteColor()
NSLog("You deselect cell number: \(indexPath.row)!")
}When I tap the row, the didSelectRowAtIndexPath worked very well, but if I tap again, didDeselectRowAtIndexPath don't run, and didSelectRowAtIndexPath worked again.Why? I need when I tap on the first time on the row didSelectRowAtIndexPath, should be called, when I tap on the second time didDeselectRowAtIndexPath should be called