Reputation: 1532
I have a UITableViewController
with a UIView
at the bottom. (using storyboard). My UIView
is set to hidden and changes state afterwards on click of button. First, I was trying to resize (increase height basically) my UIView on IBAction
(buttonClick) using self.concluidoView.frame = CGRectMake(0, 0, 320, 50);
but UIView was disappearing instead.
Now, it is correctly expanding UIView
with the following code inside IBAction
:
[UIView animateWithDuration:1.0
animations:^{
CGRect frame = self.concluidoView.frame;
frame.size.height += 100.0;
self.concluidoView.frame = frame;
}
completion:^(BOOL finished){
// complete
}];
The problem is that my UITableViewController is not scrolling enough to the new size, since the UIView
is the last item in my tableView
.
I've tried a few things to solve this problem, including manually trying to resize tableview
to increase it's height to the same value of the UIView
increase. I used the following code:
CGRect tableFrame = self.tableview.frame;
tableFrame.size.height += 100;
self.tableView.frame = tableFrame;
[self.tableview layoutIfNeeded];
The scrolling capacity of my tableview
was actually smaller after this code. I would like to resize tableview
and allow scrolling, either manually, since I know how much my subview
will increase, or automatically.
Upvotes: 1
Views: 809
Reputation: 8200
If you change the UITableView
's frame, all you'll do is make it extend off screen most likely. What you want to do is get the table view to recognize that the UIView
is larger. I'm assuming this UIView
is the tableFooterView
of your UITableView
. Try doing the following:
UIView *footerView = self.tableView.tableFooterView;
self.tableView.tableFooterView = nil;
self.tableView.tableFooterView = footerView;
That will force the UITableView
to reexamine the size of the footer view. I've had to do this before when changing the size of a footer view before.
Upvotes: 1