orazz / CreditCardForm-iOS

CreditCardForm is iOS framework that allows developers to create the UI which replicates an actual Credit Card.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Got error when implementing UITableVIewController. Using static table

zahedul opened this issue · comments

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.'

commented

Do you have a sample project you can send me?

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