i'm trying use xib file cell in table view. says "unexpectedly found nil while unwrapping optional value" on registernib. think it's referencing outlet don't know why occurs. view follow:
as shows, table view inside play video view controller.
my viewdidload is:
override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. self.tableview.registernib(uinib(nibname: "newesttableviewcell", bundle: nil), forcellreuseidentifier: "newesttableviewcell") }
and table view methods:
// mark: - table view data source func numberofsectionsintableview(tableview: uitableview) -> int { return 1 } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return video.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell : newesttableviewcell = tableview.dequeuereusablecellwithidentifier("newesttableviewcell") as! newesttableviewcell let vd = video[indexpath.row] cell.title.text = vd.title cell.title.textalignment = .right cell.duration.layer.bordercolor = uicolor.whitecolor().cgcolor cell.duration.layer.borderwidth = 1.0 cell.duration.layer.cornerradius = 3.0 cell.duration.clipstobounds = true cell.duration.text = vd.length imagedl(vd.imageurl){ image in cell.videoimage.image = image } cell.time.text = vd.published cell.time.textalignment = .right cell.viewed.text = vd.view cell.viewed.textalignment = .right return cell }
i used nib in other tableviewcontrollers when using in uiviewcontroller contains tableview, it'n not working. reason causes this?
thanks
the thing in line forcefully unwrapped tableview. check referencing outlet.
Comments
Post a Comment