Reputation: 29767
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?
Upvotes: 3
Views: 1507
Reputation: 1048
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!
Upvotes: 3
Reputation: 5684
my be return proper height in - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
delegate method
Upvotes: 0