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!
2
Answers
translatesAutoresizingMaskIntoConstraints needs to be set as false.
Code Be like:
The syntax is wrong, Try This :
Also view.bottomAnchor refer to superview and not safeArea , for setting it relative to safe area , you need to do like this :
28 negative will put it above the safe area.