I want to display horizontal UIStackView with 3 labels in it, but I can't see the labels...
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
let stackView = UIStackView(arrangedSubviews: [label1,label2,label3])
stackView.distribution = .fill
stackView.axis = .horizontal
stackView.spacing = 8
stackView.alignment = .center
backgroundColor = .black
addSubview(stackView)
stackView.leftAnchor.constraint(equalTo: leftAnchor, constant: 8).isActive = true
stackView.rightAnchor.constraint(equalTo: rightAnchor, constant: 8).isActive = true
stackView.topAnchor.constraint(equalTo: topAnchor, constant: 8).isActive = true
stackView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 8).isActive = true
}
I've tried with anchors, but also unsuccessfully. How to do it?