Created a table of three sections, added a click checkmarker. I can not remove the duplication checkmarker in the table on the following cells from the clicked.
import UIKit class AllExersiseTableViewController: UITableViewController { //создаем секции struct Objects { var sectionName: String! var sectionObjects: [(name: String, image:String)]! } var objectsArray = [Objects]() //создаем масив с ячейками для предотвращения дублирования чекмаркеров в таблице по нажатию var allExersiseTable = [Bool](count: 15, repeatedValue: false) override func viewDidLoad() { super.viewDidLoad() objectsArray = [Objects(sectionName: "Standing", sectionObjects: [(name: "Приседания", image:"bb"), (name: "Отжимания", image:"bt"), (name: "Подтягивания", image:"ca"), (name: "Прыжки", image:"co"), (name: "Бег", image:"de")]), Objects(sectionName: "Sitting", sectionObjects: [(name: "БЕГ", image:"ru"), (name: "ПРЫЖКИ", image:"al"), (name: "ПРИСЕДАНИЯ", image:"au"), (name: "ОТЖИМАНИЯ", image:"es"), (name: "ТОЛЧЕК", image:"fr")]), Objects(sectionName: "Special", sectionObjects: [(name: "БЕГ", image:"ru"), (name: "ПРЫЖКИ", image:"al"), (name: "ПРИСЕДАНИЯ", image:"au"), (name: "ОТЖИМАНИЯ", image:"es"), (name: "ТОЛЧЕК", image:"fr")])] } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func numberOfSectionsInTableView(tableView: UITableView) -> Int { // #warning Incomplete implementation, return the number of sections return objectsArray.count } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // #warning Incomplete implementation, return the number of rows return objectsArray[section].sectionObjects.count } //нажатие на ячейку override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { let cell = tableView.cellForRowAtIndexPath(indexPath) if cell!.accessoryType == .None { cell!.accessoryType = .Checkmark self.allExersiseTable[indexPath.row] = true } else { cell!.accessoryType = .None self.allExersiseTable[indexPath.row] = false } //убираем эфект нажатой ячейки tableView.deselectRowAtIndexPath(indexPath, animated: true) } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) //отображаем элементы ячеек cell.textLabel?.text = objectsArray[indexPath.section].sectionObjects[indexPath.row].name cell.imageView?.image = UIImage(named: objectsArray[indexPath.section].sectionObjects[indexPath.row].image) //для предотвращения дублирования чекмаркеров в таблице по нажатию cell.accessoryType = allExersiseTable[indexPath.row] ? .Checkmark : .None //цвет чекмаркера cell.tintColor = UIColor.redColor() return cell } override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String?{ return objectsArray[section].sectionName } }