by 伍雪穎
UIStackView可以垂直或水平排布多個subview, 自動為每個subview創建和添加Auto Layout constraints.
1.添加subview let logoImage:UIImageView = UIImageView(image: UIImage(named: "logo"))
logoImage.contentMode = .ScaleAspectFit
self.stackView.addArrangedSubview(logoImage)
UIView.animateWithDuration(0.25, animations: {
self.stackView.layoutIfNeeded() })
2.刪除subview self.stackView.removeArrangedSubview(logoView)