Swift: IBoutlets are nil in Custom Cell

前端 未结 2 568
时光取名叫无心
时光取名叫无心 2020-12-11 05:39

I can\'t figure out why this custom cell is not being output.

I have a custom cell set up in a storyboard (no nib). I have a text field and 2 labels which are n

相关标签:
2条回答
  • 2020-12-11 06:07

    Pretty sure that you need to remove the line

    self.timesheetTable.registerClass(TimesheetTableViewCell.self, forCellReuseIdentifier: "TimesheetCell")
    

    from viewDidLoad().

    0 讨论(0)
  • 2020-12-11 06:14

    The problem is this line:

    self.timesheetTable.registerClass(TimesheetTableViewCell.self, forCellReuseIdentifier: "TimesheetCell")
    

    Delete it. That line says: "Do not get the cell from the storyboard." But you do want to get the cell from the storyboard.

    (Make sure, however, that the cell's identifier is "TimesheetCell" in the storyboard, or you'll crash.)

    0 讨论(0)
提交回复
热议问题