I have the following UIButtons
// Create the left UIButton
let leftButton = UIButton(type: .system)
leftButton.setImage(UIImage(named: "thumbsup"), for: .normal) // Replace with your left button image name
leftButton.translatesAutoresizingMaskIntoConstraints = false
// Create the right UIButton
let rightButton = UIButton(type: .system)
rightButton.setImage(UIImage(named: "thumbsdown"), for: .normal) // Replace with your right button image name
rightButton.translatesAutoresizingMaskIntoConstraints = false
innerView.addSubview(leftButton)
innerView.addSubview(rightButton)
// Set constraints for the labels and buttons
NSLayoutConstraint.activate([
// Constraints for the left button
leftButton.bottomAnchor.constraint(equalTo: innerView.bottomAnchor, constant: -20),
leftButton.leadingAnchor.constraint(equalTo: innerView.leadingAnchor, constant: 40),
leftButton.widthAnchor.constraint(equalToConstant: 50), // Adjust the width as needed
leftButton.heightAnchor.constraint(equalToConstant: 50), // Adjust the height as needed
// Constraints for the right button
rightButton.bottomAnchor.constraint(equalTo: innerView.bottomAnchor, constant: -20),
rightButton.trailingAnchor.constraint(equalTo: innerView.trailingAnchor, constant: -40),
rightButton.widthAnchor.constraint(equalToConstant: 50), // Adjust the width as needed
rightButton.heightAnchor.constraint(equalToConstant: 50) // Adjust the height as needed
])
The problem is the left and right button don’t show up when I run the simulator. Does anyone know why?