Swift Constraints in Subclass
问题 I was wondering if there was a way to access constraints from a subclass. I have a custom view. I'm not sure if I can access the constraint I already have set in the UI, so I tried just creating the constraint from the subclass itself. class PerformanceView: UIView { func initialize() { let heightConstraint = NSLayoutConstraint(item: self, attribute: .Height, relatedBy: .Equal, toItem: superview, attribute: .Height, multiplier: 0.47, constant: 0); superview.addConstraint(heightConstraint) } }