0

I have some issue with section header height, so:

In storyboard I defined prototype and I assigned it to the section header view, in Size Inspector with height "100", but I also created a method "heightForHeaderInSection" where I set "90".

The result is that simulator draws section with height 90, but when I call "self.tableView.sectionHeaderHeight" it gives me 100.

How can I get height from "heightForHeaderInSection" with 90 value programmatically?

rudald
  • 364
  • 5
  • 18
  • Why you are setting static height for header? Try return tableView.sectionHeaderHeight; / return UITableViewAutomaticDimension; instead. – Bharat Modi Mar 18 '16 at 09:56
  • Thanks for response and good solution, but I asked about something different. I would get height of specific header in section to calculate something, but I don't know how. – rudald Mar 18 '16 at 10:10
  • 1
    I haven't tried this, try this if it could return the correct height for specified headerView in section. CGFloat headerViewHeight = [self.tableView headerViewForSection:0].frame.size.height; – Bharat Modi Mar 18 '16 at 10:14
  • You can accept the answer if it solved your problem. Thanks! – Bharat Modi Mar 18 '16 at 10:37

1 Answers1

0

Try this

CGFloat headerViewHeight = [self.tableView headerViewForSection:0].frame.size.height;
Bharat Modi
  • 4,158
  • 2
  • 16
  • 27