Кнопка сделана виде radiobutton.
Вот так выглядит Main.Storyboard
Вот так выглядит TaskTableVC
class TaskTableVC: UITableViewController {
@IBOutlet weak var addProductButton: UIButton!
var test : [String] = ["Product_name_1", "Product_name_2", "Product_name_3", "Product_name_4", "Product_name_5"]
override func viewDidLoad() {
super.viewDidLoad()
addProductButton.setTitleColor(.textColor, for: .normal)
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return test.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! ParamentrsTableViewCell
cell.nameProduct.text = test[indexPath.row]
return cell
}
@IBAction func radioButtonAction(_ sender: Any) {
//Кнопка, по нажатию на ее должна удаляться ячейка
}
}
Вот так выглядит ParamentrsTableViewCell
class ParamentrsTableViewCell: UITableViewCell {
@IBOutlet weak var radioButton : UIButton!
@IBOutlet weak var nameProduct : UILabel!
}