Ich habe hier zwei verschiedene Testfälle. Im Fall 1 habe ich die gesamte Anzahl von Einträgen aus CoreData ausgedruckt und es funktioniert. Ich habe versucht, genau dasselbe in app2 zu tun, aber es funktioniert nicht. Alles, was ich tun möchte, ist in jeder einzelnen Zelle mit allen Kerndateneinträgen.CoreData auf Tabellenansicht Zelle drucken
APP1
override func viewDidLoad() {
super.viewDidLoad()
user = coreDataHandler.getSortedData()
for i in user! {
displayL.text = String(i.username)
}
}
APP2
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
user = coreDataHandler.getSortedData()
return user!.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = cctv.dequeueReusableCell(withIdentifier: "cell")
for i in user! {
cell?.textLabel?.text = String(describing: i.username)
return cell!
}
return cell!
}
Welcher Art ist 'username', aus dem Sie eine' String' erstellen müssen? Und niemals * bekomme Daten in 'numberOfRowsInSection' – vadian