title: UITableView headerView scroll offset
body: <p>I'm facing a problem with <code>UITableView</code> and it's property <code>tableHeaderView</code>.</p>
  <p>I want to have the <code>tableHeaderView</code> to behave like <code>UISearchBar</code>, i.e. the content offset should be  the of tableHeaderView.
  Setting contentOffset, etc. didn't help when the table view wouldn't fill the view's frame.</p>
  <p>Here's a screenshot of the current behavior:</p>
  <p><a href="https://i.stack.imgur.com/KbyXo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KbyXo.png" alt="current behavior" /></a><br />
  <sub>(source: <a href="http://tubtub.de/export/now.png" rel="nofollow noreferrer">tubtub.de</a>)</sub></p>
  <p>And how I'd like it to have:</p>
  <p><a href="https://i.stack.imgur.com/DytOV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DytOV.png" alt="desired behavior" /></a><br />
  <sub>(source: <a href="http://tubtub.de/export/desired.png" rel="nofollow noreferrer">tubtub.de</a>)</sub></p>
  <p>I'm inserting the <code>headerView</code> in <code>viewDidLoad</code> as follows:</p>
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
      headerView.backgroundColor = [UIColor redColor];
      self.tableView.tableHeaderView = headerView;
  }
  </code></pre>
  <p>Any help or hint is highly appreciated. Thanks!</p>
  <p>EDIT: I made it working by utilizing UIScrollViewDelegate and subclassing UITableView. Check it out on the <a href="https://github.com/bhr/BHRSnappingTableView/" rel="nofollow noreferrer">github repo</a> provided.</p>