Ich habe mit Swift ein Ausklappmenü erstellt. Ich habe das schon oft gemacht, aber als ich es heute erstellt habe, bekomme ich diesen Fehler (siehe Screenshot). Es könnte nur ein einfacher Fehler sein, den ich gemacht habe. HierSwift: Tabellenansicht Superklassenfehler
ist der Code, dass ich denke, das Problem verursacht:
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("Cell")! as UITableViewCell
if cell == nil{
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell!.backgroundColor = UIColor.clearColor()
cell!.textLabel!.textColor = UIColor.darkTextColor()
let selectedView:UIView = UIView(frame: CGRect(x: 0, y: 0, width: cell!.frame.size.width, height: cell!.frame.size.height))
selectedView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.3)
cell!.selectedBackgroundView = selectedView
}
cell!.textLabel!.text = tableData[indexPath.row]
return cell
}
Screenshot:
UPDATE: Ich habe versucht, das Entfernen override
Hoffe jemand kann helfen!
@RDC Danke für die Anregung zurück, aber hat nicht funktioniert. Siehe Update – Jordan
Haben Sie tatsächlich ** die für die 'UITableView' Delegierten erforderlichen Protokolle ** implementiert? 'Klasse YourViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {/ * ... * /}' –
@ AlejandroIván Ja – Jordan