3

I have tableview, with a view as a child as the tableview header.

I would like the view to grow in height based on interaction with a button on the navigation bar.

I have tried to do this with the following without success:

- (IBAction)submit:(id)sender {
    _submitView.frame = CGRectMake(0, 0, _submitView.frame.size.width, 568);

    [submitView setNeedsDisplay];
    [self.tableview reloadData];


}

Neither of the reload methods refresh the submitView so that it grows larger when the button is pressed.

How can I change the height of the view when a user triggers this function?

Daniyar
  • 2,975
  • 2
  • 26
  • 39
Atma
  • 29,141
  • 56
  • 198
  • 299

2 Answers2

3

If this is referring to a table view header and NOT a section header then this question suggests that you need to set the header again after changing the frame of it - Something like this should work:

CGRect newFrame = headerView.frame;
newFrame.size.height = newFrame.size.height + webView.frame.size.height;
headerView.frame = newFrame;
[self.tableView setTableHeaderView:headerView];

If this is referring to a section header then sage444 has the correct method.

Good luck!

Community
  • 1
  • 1
GracelessROB
  • 1,048
  • 8
  • 11
0

my be return proper height in - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section delegate method

sage444
  • 5,661
  • 4
  • 33
  • 60