Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS8 UITableView with autolayout has a blank space above cells

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

like image 432
Alex Stone Avatar asked Dec 20 '22 05:12

Alex Stone


2 Answers

Try toggling the UIViewController property in Interface Builder named:

Adjust Scroll View Insets
like image 50
Daniel Avatar answered May 22 '23 02:05

Daniel


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

like image 27
Dan Atherton Avatar answered May 22 '23 02:05

Dan Atherton