Scroll UITableView so that the header isn't visible
Posted
by DASKAjA
on Stack Overflow
See other posts from Stack Overflow
or by DASKAjA
Published on 2009-07-03T17:33:11Z
Indexed on
2010/06/13
5:02 UTC
Read the original article
Hit count: 388
I've got a UITableView with a UISearchBar as the tableViews.tableHeaderView. Just like the new Mail.app, Notes.app, etc. in 3.0. I want to hide the SearchBar until the user drags it in his sight.
My attempt only works when there're a couple of items in the tableView, so that the tableView actually wants to scroll. I call this in loadView:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self._tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
Nevertheless it seems that Apple handles such a serachbar differently. After draging out the searchbar it doesn't seem to be bounded to the tablecells anymore (in Notes.app, not in Mail.app).
But perhaps Apple has a distinct method for that new 3.0 behaviour, and I just can't find it?
© Stack Overflow or respective owner