I have a button in my layout and I would like to specifically set it to SafeArea.bottom = button.bottom 28. I am having errors when I try using
btnAddRecord.translatesAutoresizingMaskIntoConstraints = false
btnAddRecord.bottomAnchor.constraint.equalTo(self.view.safeAreaLayoutGuide.bottomAnchor, constant: 66).isActive = true
I am getting an error 'Reference to member 'equalTo' cannot be resolved without a contextual type'
May I know where I am going wrong and how to fix this issue? Thanks!
CodePudding user response:
translatesAutoresizingMaskIntoConstraints needs to be set as false.
Code Be like:
yourButton.translatesAutoresizingMaskIntoConstraints = false
yourButton.bottomAnchor.constraint.equalTo(constraint: view.bottom, constant: 28)
CodePudding user response:
Try
view.addSubview(button)
button.translatesAutoresizingMaskIntoConstraints = false
button.bottomAnchor.constraint.equalTo(constraint: view.bottomAnchor, constant: 28).isActive = true