uitableview - Swift: How can I get the UItextlabel from headerViewer -


i need string set in headerview of row selected. need information decide view row send to. allready have row name. need aswell name of string used in headerview.

follow steps

  1. take array of section header name , declare above viewdidload methods

    let sectionheaderarray = ["header1", "header2"] 
  2. implement method view section header

    func tableview(tableview: uitableview, willdisplayheaderview view: uiview, forsection section: int)  {     let header = view as! uitableviewheaderfooterview     header.textlabel?.text = self.sectionheaderarray[section] } 
  3. in diddeselectrowatindexpath method can section name

    func tableview(tableview: uitableview, diddeselectrowatindexpath indexpath: nsindexpath) {     let section_name = self.sectionheaderarray[indexpath.section] } 

hope you.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -