Basically, I am trying to reset some NSConstraints when the user taps a button.
My constraint outlets:
@IBOutlet weak var firstButtonHeight: NSLayoutConstraint!
@IBOutlet weak var secondButtonheight: NSLayoutConstraint!
@IBOutlet weak var thirdButtonHeight: NSLayoutConstraint!
Example action:
@IBAction func firstButtonHeight(sender: UIButton) {
firstButtonHeight.constant = 100
}
I thought I could put them into an array (below) and iterate through them before running firstButtonHeight.constant = 100
:
var constraints: [NSLayoutConstraint] = [firstButtonHeight, secondButtonheight, thirdButtonHeight]
for constraint in constraints {
constraint.constant = 50 //Original constraint value
}
However, I get the error Instance member 'firstButtonHeight' cannot be used on type 'ViewController'
. When did firstButtonHeight
become a ViewController?