Ios swift3中的tableview单元格

Ios swift3中的tableview单元格,ios,swift,uitableview,Ios,Swift,Uitableview,当我开始使用iOS swift3.0时 我正在尝试使用swift3中的xib单元格创建简单的表视图。我已经阅读了一些教程,但仍然找到了正确的示例。有人能帮我吗 请找到我下面的代码 class Myclass: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tabelviewoutlet: UITableView! let animals: [String] = ["Horse"

当我开始使用iOS swift3.0时

我正在尝试使用swift3中的xib单元格创建简单的表视图。我已经阅读了一些教程,但仍然找到了正确的示例。有人能帮我吗

请找到我下面的代码

class Myclass: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet weak var tabelviewoutlet: UITableView!
let animals: [String] = ["Horse", "Cow", "Camel", "Sheep", "Goat"]
let cellIdentifier = "Cell"


override func viewDidLoad() {
    super.viewDidLoad()  
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return self.items.count;
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell:UITableViewCell = self.tableView.dequeueReusableCell(withIdentifier: "td")! as UITableViewCel
}

请找到密码并告诉我

import UIKit
class ViewController: UIViewController,UITableViewDataSource{


    @IBOutlet weak var tabelviewoutlet: UITableView!
    let animals: [String] = ["Horse", "Cow", "Camel", "Sheep", "Goat"]
    let cellIdentifier = "Cell"


    override func viewDidLoad() {
        super.viewDidLoad()

          tabelviewoutlet.dataSource = self

        tabelviewoutlet.register(UINib(nibName: "aTableViewCell", bundle: nil), forCellReuseIdentifier: "Cell")


    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
    {
        return animals.count
    }

     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! aTableViewCell
        //cell.albl?.text = self.animals[indexPath.row]
       cell.albl.text=self.animals[indexPath.row]

        return cell
    }
}
使用这样的代码

class Myclass: UIViewController, UITableViewDelegate, UITableViewDataSource {

    @IBOutlet weak var tabelviewoutlet: UITableView!

    let animals: [String] = ["Horse", "Cow", "Camel", "Sheep", "Goat"]

    override func viewDidLoad() {
        super.viewDidLoad()
        // register your xib
        self.tblMyCustom.register(UINib(nibName: "CustomTableCell", bundle: nil), forCellReuseIdentifier: "customCell")
        self.tblMyCustom.delegate = self
        self.tblMyCustom.datasource = self
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return self.animals.count;
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let customCell: CustomTableCell! = tableView.dequeueReusableCell(withIdentifier: "customCell") as? CustomTableCell
        customCell.myLabel.text = self.animals[indexPath.row]
        return customCell
    }
}

类Myclass:UIViewController、UITableViewDelegate、UITableViewDataSource当我使用该类时,我遇到了错误执行
UITableViewDataSource