0
votes

< iOS 11 below code works to hide the tableView Section Height for the first section.

self.tableView.estimatedSectionHeaderHeight = 20.0
self.tableView.contentInset = UIEdgeInsetsMake(-18.0, 0.0, 0.0, 0.0)

For iOS 11 what should works? I tried setting section 0 to 'nil' from titleForHeaderInSection and heightForHeaderInSection to '0' for first section but it didn't work.

2
Try to set section header height = 0.1pkc456
how many sections you have?Andrea Mugnaini
@AndreaMugnaini 3Nitesh
self.tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 0.01)) try thisKamal Upasena

2 Answers

0
votes

try this

This alone will not show a section header:

func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
    return nil
}

This will show a section header with no title:

func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
    return nil
}

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    return nil
}
-1
votes

The follow method is invalid in iOS11

1.controller.automaticallyAdjustsScrollViewInsets = false

You can use follow method to replace

2.controller.view.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

if it still doesn't work maybe you can write follow code

3.tableView.tableHeaderView = UIView.init();