Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tableview hidden under navigation bar (but only for one tab)

I am using Xcode 5 with storyboard and auto layout. My views are:

  • root navigation view
  • tab view controller (its the default view for the navigation view)
  • two tab views

In both tab views, I put a UITableView on it, and I set up the standard IB stuff. Both tab view controllers are nearly identical in code in terms of setup (they both derive from UIViewController).

For the tableview however, things are weird. The first table view has the right setting, where the cells start "below the navigation" and you can scroll it up. The second table view starts with the cells "under the navigation" - it seems like the insets are wrong.

But why would it be wrong for just the second tab view, and not the first? I did not do anything funky with either, and I've pored over the code multiple times to be sure that both tableview controllers are nearly identical (except in the cell contents).

(on the second image, notice the bit of green under the "Carrier" status bar).

First tab view - looks right

Second tab view - looks wrong

like image 464
tng Avatar asked May 31 '14 06:05

tng


3 Answers

Trying toggling the "Adjust Scroll View Insets" in the view controller's Attributes inspector. You want it ticked.

enter image description here

like image 108
bilobatum Avatar answered Nov 02 '22 00:11

bilobatum


I faced this same problem once.

Try toggling the "Under Top Bars" in the view controller's Attributes inspector.

This worked for me. Hope it does for you too. Thanks.

like image 20
try catch finally Avatar answered Nov 02 '22 00:11

try catch finally


Sadly it seems that if you have the TabBarController as the RootViewController for the NavigationController ( Navigation -> Tab -> Table View C, Table View C ) this will happen. The fix may be to give each table view their own navigation controller ( Tab -> (Nav -> Table View C), (Nav -> Table View C) While that may not work with all desired designs, it worked in my situation (which was the same as yours)

like image 4
BadPirate Avatar answered Nov 02 '22 01:11

BadPirate