UITableView 不填充 UITabBarController 内的自定义单元格

UITableView doesn't fill custom cells inside of UITabBarController

我有 UITabBarController,在其中一个选项卡上我有 UIViewController,里面有 UITableView。

我创建了自定义单元格 class。

如果我在没有 UITabBarController 的情况下填充 tableView 自定义单元格(我将入口点放在 UIViewController 中)一切正常,但如果我首先使用 UITabBarController,当我到达 UITableView 选项卡时,我的单元格不会填充任何数据。 哪里可能是错误?

import UIKit

class blaViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    @IBOutlet weak var tableView: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    func tableView(tableView:UITableView, numberOfRowsInSection section:Int) -> Int {
        return 3
    }

    func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath:NSIndexPath) -> UITableViewCell {
        let cell = self.tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! blaTableViewCell
        cell.myLabel.text = "123"
        return cell
    }
}

import UIKit

class blaTableViewCell: UITableViewCell {

    @IBOutlet weak var myLabel: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
 @IBOutlet weak var myLabel: UILabel!

努力做强变

@IBOutlet var myLabel: UILabel!

尝试勾选所有约束的安装复选框,而不仅仅是 wh wr。它对我有用。此处也有描述: