ios - Set title of UIButton that's located in a UICell -
i don't understand why can't set title of uibutton
. crashes 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:
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
Post a Comment