@IBAction func addNewImage(sender: UIButton) {
let rect = CGRectMake(0, 0, 30, 30)
let myView = UIView(frame: rect)
myView.backgroundColor = UIColor.greenColor()
myView.alpha = 1.0
myStackView.addArrangedSubview(myView)
}
This code above is just an action triggered by a button. All I want to do is just add a new UIViewto the UIStackView which is named myStackView here, and finally I found the stackView re-layout all the arrangedViews but the newly added view can't be seen, I don't know why.
Thank you for your great answers below.