I can't see my nameLabel and companyLabel, can you please explain me why i cant see it. Only what i see is imageView and getButton, one on left, and another on right. if i do not implement VerticalStackView i see both of them. But if i implement VerticalStackView inside of another stackView, i dont see it. they go blank. Can you please help. Also your tutorials are helpful :)
class AppRowCell: UICollectionViewCell {
var imageView: UIImageView!
var nameLabel: UILabel!
var companyLabel: UILabel!
var getButton: UIButton!
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setup()
AppRowStackView()
}
fileprivate func setup() {
imageView = UIImageView(cornerRadius: 8)
imageView.backgroundColor = .yellow
imageView.constrainWidth(constant: 64)
imageView.constrainHeight(constant: 64)
addSubview(imageView)
nameLabel = UILabel(text: "App Name", font: .systemFont(ofSize: 20))
addSubview(nameLabel)
companyLabel = UILabel(text: "Company Name", font: .systemFont(ofSize: 13))
addSubview(companyLabel)
getButton = UIButton(title: "GET")
getButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
getButton.backgroundColor = UIColor(white: 0.95, alpha: 1)
getButton.constrainWidth(constant: 80)
getButton.constrainHeight(constant: 32)
getButton.layer.cornerRadius = 32 / 2
addSubview(getButton)
}
fileprivate func AppRowStackView() {
let stackView = UIStackView(arrangedSubviews: [imageView, VerticalStackView(arrangedSubviews: [ nameLabel, companyLabel ], spacing: 4 ), getButton])
stackView.spacing = 16
stackView.alignment = .center
addSubview(stackView)
stackView.fillSuperview()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}