I have a Storyboard with a UITableView. The tableView gets a tableViewHeader like:
----------------------
| Button |
| Label |
----------------------
The button appears only if a condition is met. Also, if the button is clicked the header must be:
----------------------
| Label |
----------------------
I tried lots of things, like:
[UIView animateWithDuration:0.3 delay:0 options: UIViewAnimationCurveEaseOut
animations:^{
self.tableView.contentOffset = CGPointMake(0, 59);
}
completion:^(BOOL finished) {
if (finished) {
self.tableView.contentOffset = CGPointMake(0, 59);
self.viewButton.hidden = YES;
}
}
];
This works great if I click the button. But once I scroll the table view up, it bounces at 0 and then offset is lost, my table view looks like:
----------------------
| |
| Label |
----------------------
I also tried all kinds of views manipulation and tried reset the tableViewHeader, like:
CGRect frame = self.tableView.tableHeaderView.frame;
frame.size.height = 31;
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:frame];
[self.tableView.tableHeaderView addSubview:self.viewTitle];
Getting the result:
----------------------
| |
| Label |
----------------------
I saw something about changing my UITableViewController to a UIViewController and my problems will be resolved by manipulating the view controller frame, but I have like 10 table view and I don't really have time to make all the changes I need.
Please, can someone help me?