1

I have UITableView with UISearchBar located inside tableHeaderView I want to keep header view invisible until user scrolls up so I do:

self.tableView.contentOffset = CGPointMake(0, self.searchBar.frame.size.height);

My problem is that after I do any insert or delete (I use NSFetchedResultsController) UITableView scrolls to 0,0 and show up table header.

Is there a way to keep scrolling off after insert or delete operation is made ?

Marcin
  • 3,694
  • 5
  • 32
  • 52

1 Answers1

0

The contentOffset is analogous to the position from where you want the UIScrollView (which encompasses the UITableView) to begin. If your table view was more than a screen-worth of content, you'll notice that you'd still be able to scroll upwards to the tableViewHeader which you're trying to hide.

It sounds like you should instead play around with the contentInset (before and after an insert/delete action) to hide and display the tableViewHeader.

pxlshpr
  • 986
  • 6
  • 15