ios - Set title of UIButton that's located in a UICell -


i don't understand why can't set title of uibutton. crashes here:

enter image description here

func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? {     if(section == 0) {         let view = uiview()         view.alpha = 0         return ktableheadershouldsticktotop ? view : carouselviewcontroller.view     } else {         let cell = tableview.dequeuereusablecellwithidentifier("newsfeedsectionheadercell") as! newsfeedsectionheadercell         cell.delegate = self         cell.datasource = self          cell.followingbutton.settitle("test", forstate: .normal)         return cell     } } 

it connected in .xib file:

enter image description here

please check whether can take cell object in viewforheaderinsection: method because per knowledge viewforheaderinsection: called before cellforrowatindexpath. put breakpoint @

let cell = tableview.dequeuereusablecellwithidentifier("newsfeedsectionheadercell") as! newsfeedsectionheadercell 

and check variable view (left console see logs) or hover on object see whether object nil or not. nil raising exception.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -