I am trying to accomplish the following:
- hide the search bar
- scroll the table to the first row
This code accomplishes the goal, but leaves a huge white gap where the search bar used to be:
[self.theSearchBar setHidden:YES];
NSIndexPath *pathToFirstRow = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView scrollToRowAtIndexPath:pathToFirstRow atScrollPosition:UITableViewScrollPositionTop animated:YES];
Normally I use this to hide the scroll bar:
[self.tableView setContentOffset:CGPointMake(0, 44) animated:YES];
But after the call to scrollToRowAtIndexPath, it has no effect.
Is there either some way to make this work, or some other way to accomplish the same thing?
Thanks!
Try resetting the frame of your scrollview to remove the gap.