ios - Fatal Error: unexpectedly found nil while unwrapping an Optional Value making Custom UITableViewCell -


i trying create custom uitableviewcell outlets uilabels , uiimageviews. however, whenever try set value of these outlets, fatal error occurs. have uitableview inside of regular viewcontroller

func tableview(tableview: uitableview,         cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {             var cell: storetablecell = tableview.dequeuereusablecellwithidentifier("cell",                 forindexpath: indexpath) as! storetablecell             let currentitem = storesection[indexpath.row]             cell.itemname.text = currentitem[0]             cell.itemdescription.text = currentitem[1]             cell.itemimage.image = uiimage(contentsoffile: currentitem[2])             cell.itemprice.text = currentitem[3]             return cell     } 

my currentitem array never empty, , has string @ each index.

these storetablecell class:

class storetablecell: uitableviewcell{      @iboutlet var itemname: uilabel!     @iboutlet var itemimage: uiimageview!     @iboutlet var itemdescription: uilabel!     @iboutlet var itemprice: uilabel!      required init(coder adecoder: nscoder) {         fatalerror("nscoding not supported")     }      override init(style: uitableviewcellstyle, reuseidentifier: string?) {         super.init(style: style, reuseidentifier: reuseidentifier)      }   } 

the error occurs in (cellforrowatindexpath) whenever try set 1 of outlets' values, regardless of order assign them. suggestions, i'm pretty new swift.

i'm betting 1 of outlets not setup correctly. it's easy mess outlet connections code leaving nil references. go storyboard , @ top of view controller yellow circle square in it. right click view of outlets. may find old 1 still in there marked yellow warning triangle. remove clicking x near it.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -