Guest User

Untitled

a guest
Jan 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import UIKit
  2.  
  3. extension UITableViewCell {
  4. @IBInspectable
  5. var checked: Bool {
  6. get { return detailTextLabel?.text?.count ?? 0 > 0}
  7. set(value) {
  8. detailTextLabel?.text = value ? "✔️" : ""
  9. }
  10. }
  11. }
  12.  
  13. class SettiongAllowanceTableViewController: UITableViewController {
  14. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  15. tableView.deselectRow(at: indexPath, animated: true)
  16. tableView.cellForRow(at: indexPath)?.checked = !(tableView.cellForRow(at: indexPath)?.checked ?? true)
  17. }
  18. }
  19.  
  20. class SettiongAllowanceViewController: ViewController {
  21.  
  22. override func viewDidLoad() {
  23. super.viewDidLoad()
  24.  
  25. // Do any additional setup after loading the view.
  26. }
  27.  
  28.  
  29. /*
  30. // MARK: - Navigation
  31.  
  32. // In a storyboard-based application, you will often want to do a little preparation before navigation
  33. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  34. // Get the new view controller using segue.destination.
  35. // Pass the selected object to the new view controller.
  36. }
  37. */
  38.  
  39. }
Add Comment
Please, Sign In to add comment