How to set the tableview's top using contentinset property while being at the bottom of the table
- by neha
Hi all,
I'm having a tableview with 20 rows and 250 as their rowheight. While I'm at the bottom of the tableview, I want to shift the tableview upwards by 65px. I tried doing
self.tableView.contentInset = UIEdgeInsetsMake(-65.0f, 0.0f, 0.0f, 0.0f);
Also
self.tableView.contentInset = UIEdgeInsetsMake((4633.0f - 65.0f), 0.0f, 0.0f, 0.0f);
where 4633.0f is my contentoffset.y, but with no success.
When the last cell is pulled upwards, I'm showing a view below the last cell with an activity indicator on it to depict that more data is getting loaded. I need to keep that view visible for 2 seconds so I want to push the tableview cells up and after that I want to bring the tableview to its original position and reset the view below that.
I'm doing this
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.2];
// self.tableView.contentInset = UIEdgeInsetsMake((4633.0f - 65.0f), 0.0f, 0.0f, 0.0f);
self.tableView.contentInset = UIEdgeInsetsMake(- 65.0f, 0.0f, 0.0f, 0.0f);
[UIView commitAnimations];
and then calling a function to reset it back as
self.tableView.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f);
Can anybody please suggest how to do it?
Thanx in advance.