I want my stack view to have three views: red image, blue image and register view. The thing is that while the red and blue button appear just fine, the register view does not.
This is how I set up and place my stack view inside my view controller view:
func setupSocialStackView() {
let socialStackView = UIStackView(arrangedSubviews: redImage, blueImage, registerView])
socialStackView.axis = .vertical
socialStackView.distribution = .fillProportionally
view.addSubview(socialStackView)
socialStackView.spacing = 8
// NSLayoutAnchor constraints here to place stack view
// inside my view controller view
}
This is the code for my register view which doesn't show up:
lazy var registerView: UIView = {
let containerView = UIView()
// Register button
let registerButton = UIButton(type: .system)
registerButton.setTitle("Register", for: .normal)
registerButton.titleLabel?.font = UIFont.systemFont(ofSize: 12, weight: UIFontWeightLight)
registerButton.titleLabel?.textAlignment = .center
registerButton.setTitleColor(UIColor.black, for: .normal)
registerButton.titleLabel?.textColor = UIColor(r: 91, g: 90, b: 90)
registerButton.addTarget(self, action: #selector(presentRegisterController), for: .touchUpInside)
containerView.addSubview(registerButton)
return containerView
}()
The other two arrange views of the stack view are UIImageView
s.
Why are the two images there and the register view is not? Am I missing something?