-
Notifications
You must be signed in to change notification settings - Fork 0
/
secondViewController.swift
82 lines (49 loc) · 2.09 KB
/
secondViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// secondViewController.swift
// My Diabetic Manager
//
// Created by Emmanuele Montagna on 02/02/17.
// Copyright © 2017 Vincenzo De Rosa. All rights reserved.
//
import UIKit
class secondViewController: UIViewController ,UITableViewDataSource, UITableViewDelegate{
var lista=singola_pagina.nomeElemChecked
@IBOutlet weak var dismissou: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func dismissAction(_ sender: AnyObject) {
self.dismiss(animated: true,completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return lista.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier="Cell"
let cell=tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
cell.textLabel?.text = lista[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete{
lista.remove(at: indexPath.row)
if (contatori[singola_pagina.paginaCorrente]>0)
{
totali[singola_pagina.paginaCorrente]-=NSString(string: valore_tot).doubleValue
contatori[singola_pagina.paginaCorrente]-=1
visibleCounter-=1
if !singola_pagina.nomeElemChecked.isEmpty {
singola_pagina.nomeElemChecked.removeLast()
}
}
}
tableView.deleteRows(at: [indexPath], with: .fade)
}
}