Answer the question
In order to leave comments, you need to log in
How to display the total number of filled cells?
How to display the number how many cells are in total?
That is, I have a list of orders. And how to calculate the total number of orders and display?
Answer the question
In order to leave comments, you need to log in
class TableView: UITableViewController {
var herovo: [Eprst] = []
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getData()
}
func getData() {
do {
herovo = try context.fetch(Eprst.fetchRequest())
} catch {
print("Fetching Failed")
}
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return herovo.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MainTableViewCell
let myHerovoBaza = herovo[indexPath.row]
cell.label.text = myHerovoBaza.zakazTitle
return cell
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question