0

i´m having a tableview with an headerview inside. Theres no cell in the tableview, only this one headerview which have some subviews!

On ios7 everything works perfect when i do:

- (void)viewDidLoad {

//calculate content stuff
.
.
.

[self.headerView setNeedsLayout];
[self.headerView layoutIfNeeded];

CGFloat height = [self.headerView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height + self.headerView.frame.origin.y;


CGRect headerFrame = self.headerView.frame;
headerFrame.size.height = height;
self.headerView.frame = headerFrame;

[self.tableView setTableHeaderView:self.headerView];

}

On ios6 the headerView height is always wrong and the HeaderView is not heigh enough! What could be the Problem?

Davis
  • 1,253
  • 4
  • 17
  • 38

1 Answers1

0

try changing this line:

CGFloat height = [self.headerView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height + self.headerView.frame.origin.y;

with:

CGFloat height = [self.headerView.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height + self.headerView.frame.origin.y;
Tekaya Marouene
  • 620
  • 3
  • 14