4

I've created a UIViewController in a storyboard using autolayout and it has an embedded UITableView. For some reason there is white space above the table view section. My expectation is that the tableview would split all available space into cells and have cells starting right from the top.

What is causing the table view to add empty space above the first section when using auto layout and size classes?

(See screenshot below, the white space beneath "television" and above "Prototype cells" is the problem) enter image description here

I've examined the constraints and insets, and cant see anything wrong with them: enter image description here

UPDATE: Here's the scene hierarchy enter image description here

Alex Stone
  • 46,408
  • 55
  • 231
  • 407

2 Answers2

10

Try toggling the UIViewController property in Interface Builder named:

Adjust Scroll View Insets
Daniel
  • 8,794
  • 4
  • 48
  • 71
1

If you drag a view into the table view it becomes the tableviews headerview that gives a space similar to what you see. Could this be the issue? Your posted layout looks correct.

Alternativley If you click on the Watch view controller in the hierarchy and switch in the simulated metrics section the top bar property from inferred to translucent navigation bar and back again this seems to move the cells down in the tableview when it is set to a translucent navigation bar

Dan Atherton
  • 161
  • 6
  • The tableview has no header, only 3 prototype cells – Alex Stone Apr 13 '15 at 19:51
  • Im just playing arround trying to recreate the effect. If you click on the Watch view controller in the hierarchy and switch in the simulated metrics section the top bar property from inferred to translucent navigation bar and back again this seems to move the cells down in the tableview when it is set to a translucent navigation bar – Dan Atherton Apr 13 '15 at 20:27