0

I faced with such a problem. Text my cell crawls under the table section, became a google but could not find a solution. Before doing these things, when I was only UITableViewController without additional elements such as segments. Everything worked perfectly. Tell me how to solve this problem. Thank you!

enter image description here

func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let cell = tableView.dequeueReusableHeaderFooterViewWithIdentifier("CommonSectionTableView") as! CommonSectionTableView
        cell.titleLabel.text = self.ordersSectionName[section]
        return cell
}


func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    return 55.0
}
user2759544
  • 181
  • 1
  • 10

1 Answers1

0

Try this code....

  //If you want to place a header
  let header = "Your Header Name"
  func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
    return header 
}

//If you using section header
 override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "Section \(Your Section Name or Array)"
}

Above code will put the headerView just above your tableView...

If you want to customise your headerView checkout the following questions

How can we add image in UITableView section header using swift?
Customize UITableView header section
http://www.ioscreator.com/tutorials/customizing-header-footer-table-view-ios8-swift

Community
  • 1
  • 1
Joe
  • 8,868
  • 8
  • 37
  • 59
  • Can you upload another screenshot that covers the entire screen.did you look at the link.what output you getting same or any changes? – Joe Oct 15 '16 at 22:41