ios - Why is my UILabel nil? -


i have link 3 uilabels in table cell custom class, separate file vc (view controller). listoftasks dictionary tuples inside. here's relevant code:

func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = tableview.dequeuereusablecellwithidentifier("mycustomtableviewcell", forindexpath: indexpath) as! mycustomtableviewcell      let (name,description,date) = listoftasks[indexpath.row]     cell.title.text = name //here error: "fatal error: unexpectedly found nil while unwrapping optional value"     cell.subtitle.text = description     cell.date.text = date      return cell } 

why giving me error?

i did check connections already.

p.s. person thinking duplicate of this, answer question doesn't solve problem.

edit: code mycustomtableviewcell:

import uikit  class mycustomtableviewcell: uitableviewcell {     @iboutlet weak var title: uilabel!     @iboutlet weak var subtitle: uilabel!     @iboutlet weak var date: uilabel! } 

variables:

cell.title: nil

cell.subtitle: nil

cell.date: nil

edit 2: screenshot of firstviewcontroller:

enter image description here

edit 3: maybe didn't check connections thoroughly enough. normal circles empty in class? see edit 7.

edit 4: same error whenever try assign .text value it, no matter where. tried doing in class have linked to; same error.

edit 5: doesn't seem fact have weak connection; strong still gives me error.

enter image description here

edit 6: uploaded project files github interested in looking @ them.

edit 7: managed @iboutlets working correctly.

i think should remove code below if exists:

self.tableview.registerclass(tableviewcell.self, forcellreuseidentifier: "cell") 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -