user3629571
user3629571

Reputation: 13

UITableView ambiguous height

I have UITableView in UIViewController built in a Storyboard. So far so good everything is well until the moment I am taking the viewController's view and set it as a subview for another viewController's view.
Here is a little more code how I do it:

let notificationsSB = UIStoryboard(name: "NotificationsScene", bundle: nil)
let vc = notificationsSB.instantiateViewController(withIdentifier: "NotificationsNavigationController")
vc.view.frame = containerView.bounds
containerView.addSubview(vc.view)

So I use this ViewController on another place and everything visualizes correctly but when I change its frame and add it to another VC's view hierarchy the UITableView's height gets messed up.
When I open the view debugger I can see that it gives me a warning about the table view height.

Here is what the whole thing look like:
[here is what the whole thing look like


A little from the storyboard:
enter image description here

Any suggestions would be appreciated. I tried to make everything from the beginning creating a new UIViewController in the same storyboard and so on but nothing gave me results. Thank you

Upvotes: 1

Views: 1413

Answers (1)

DonMag
DonMag

Reputation: 77486

It kinda looks like you are constraining the UITableView to its superview's Layout Guide... but when you load everything into another container, you lose the Layout Guide.

Try changing the Bottom Space constraint to be relative to the superview, not to the Layout Guide.

Upvotes: 3

Related Questions