Alex Stone
Alex Stone

Reputation: 47344

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

Upvotes: 4

Views: 893

Answers (2)

Dan Atherton
Dan Atherton

Reputation: 161

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

Upvotes: 1

Daniel
Daniel

Reputation: 9040

Try toggling the UIViewController property in Interface Builder named:

Adjust Scroll View Insets

Upvotes: 10

Related Questions