Got error when implementing UITableVIewController. Using static table
zahedul opened this issue · comments
Zahedul Alam commented
Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x60400067aa40 "STPPaymentCardTextField:0x7fcf9b413d00.centerX"> and <NSLayoutXAxisAnchor:0x60400067a9c0 "UITableView:0x7fcf9b824000.centerX"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.'
Orazz commented
Do you have a sample project you can send me?
Zahedul Alam commented
It fixed.
I have changed
paymentTextField.frame = CGRect(x: 15, y: 199, width: self.view.frame.size.width - 30, height: 44)
to
paymentTextField.frame = CGRect(x: 15, y: 199, width: self.containerView.frame.size.width - 30, height: 44)
containerView
is the tableCell container view
change also
paymentTextField.centerXAnchor.constraint(equalTo: view.centerXAnchor),
to
paymentTextField.centerXAnchor.constraint(equalTo: containerView.centerXAnchor),
THANKS.
It really cool library