aldorain
aldorain

Reputation: 790

UITableView inside UIViewControllerView unexpected margins

I have normal UIViewController on my storyboard with a standard UIView which contains only one child - UITableView

When adding constraints between UIView and UITableView ( equal widths, equla heights, vertical space 0 top layout guide, horizontal space 0 for leading margin ) as a result my table view should fill it's parent.

Instead my table view appears to have left and top margins (16 and 64). The Size Inspector shows that the table views Alignment Rectangle is as follows x=16,y=64,width=600,height=600 although all my constraints have constants set to 0's. When I try to edit manually Alignment Rectangle I keep getting Misplaced Views warnig which try to restore previous values.

Any I idea what might be the cause of this strange behaviour?

Upvotes: 1

Views: 706

Answers (2)

Sunkas
Sunkas

Reputation: 9590

I had a very similar problem. It was solved by deselecting Under Top Bars under Extend Edges in the properties of the topmost UIViewController in storyboard.

Upvotes: 0

Allan  Macatingrao
Allan Macatingrao

Reputation: 2101

Click the view you want to remove margins. Open Contraint Editor uncheck Prefer Margin relative:

enter image description here

Upvotes: 3

Related Questions