UITableView Header Beneath the Navigation Bar

Due to the fact that the style of the navigation bar is translucent, I get my first section title (section # 0), hidden under my navigation bar.

I know this was asked before, and in a workaround:

self.navController.navigationBar.translucent = YES; 

This puts the problematic view in the correct position — the section title appears below the navigation bar, rather than hiding behind it, and this is what I want.

However, this is not valid for my other presentation constructions and leaves extra spaces in all of them right under my navigation bar.

How to get the section title in the right place?

+7
source share
3 answers

It is decided:

  • Open storyboard file
  • select UITableView
  • In the section “Attributes inspector” → “Scroll size” → “Insert content”, set “Top = 44” (or depending on what height of your navigation bar).

See the image below - it is in the size section:

enter image description here

And here 's how to fix it programmatically.

+14
source

To solve this problem when using SVPullToRefresh. I created a method below and inside [self.tableView.pullToRefreshView stopAnimating];

 -(void)stopPullToRefreshAnimation { [self.tableView.pullToRefreshView stopAnimating]; // call to stop animation UIEdgeInsets inset = UIEdgeInsetsMake(44, 0, 0, 0); self.tableView.contentInset = inset; self.tableView.scrollIndicatorInsets = inset; } //stopPullToRefreshAnimation 
+8
source

For other users having this problem when using (SVPullToRefresh).

This can be solved by changing view.originalTopInset to UIScrollView + SVPullToRefresh.m at any time you want to start your title.

+1
source

All Articles