I am confused a little bit about settings table view cell accessories.
I have fixed two sections in my table
What I
In Swift 2.0 using custom accessoryView uitableviewcell with swift
1º Creating Globar var IndexPath
var indexSelected = NSIndexPath()
2º In didSelectRowAtIndexPath
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
indexSelected = indexPath
TB_Lojas.reloadData()
}
3º in cellForRowAtIndexPath:
if SelectedIndexPath == indexPath {
let img = UIImageView(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
img.image = UIImage(named: "check")
cell.accessoryView = img
}else{
let img = UIImageView(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
img.image = UIImage(named: "uncheck")
cell.accessoryView = img
}
}