i have a container in my view with two tableview controllers as childs.
i have the childs as this properties in class
lazy var photoFeedVC: UserPicsTableViewController = self.makeAndAddVC()
lazy var postFeedVC: PostFeedVC = self.makeAndAddVC()
the function to make the childs
func makeAndAddVC<T: UIViewController>() -> T {
let vc = T()
self.addChildViewController(vc)
return vc
}
i want to fix each tableview to its container bottom after i increase the size of the container in viewDidAppear.
photoFeedVC.tableView.snp.makeConstraints({(make) -> Void in
make.bottom.equalTo(containerView)
})
postFeedVC.tableView.snp.makeConstraints({ make -> Void in
make.bottom.equalTo(self.view)
})
this is a contrainst tryin to fix to bottom but xcode gave me this error
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors and because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.'
here the method to increase the container
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
print("aparecio la vista")
containerView.frame.size.height += 150
self.feed.frame.size.height += 150.0
self.photoFeedVC.tableView.frame.size.height += 150.0
self.postFeedVC.tableView.frame.size.height += 150
self.scrollView.contentSize.height = containerView.height + 10
self.scrollView.layoutIfNeeded()
}