Table 视图在 Xcode 10.1 中自定义后仍然显示基本视图

Table view still showing basic even after making it custom in Xcode 10.1

我在 Xcode 8.1 中完成了之前项目中所做的一切... 但模拟器显示基本的空 table 行,即使在自定义后也是如此。 在 viewdidload 中尝试了一切,包括委托和数据源。

这是项目 link https://drive.google.com/open?id=1hBR1cH5vr-sS4gLB-VBfF6iJPYKD59rd

(抱歉 google 驱动器上传)

import UIKit

class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {

@IBOutlet weak var tblNames: UITableView!

var names = ["lonrvc","ktbfse","lnrset"]

override func viewDidLoad() {
    super.viewDidLoad()      
    self.tblNames.delegate = self
    self.tblNames.dataSource = self  
    self.tblNames.reloadData()   
}

func numberOfSections(in tableView: UITableView) -> Int {
    return 1
}

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

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {        
    let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! CustomTableViewCell        
    cell.lblName.text = names[indexPath.row]
    self.tblNames.reloadData()        
    return cell
      }
  }

我只想在自定义单元格上显示数组。(而不是在基本单元格上)

查看您的项目,只需在情节提要中为您的标签设置一些约束,它应该可以正常工作,哦,然后从 cellForRowAt.

中删除行 self.tblNames.reloadData()