清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
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()
logoImage.contentMode = .ScaleAspectFit
self.stackView.addArrangedSubview(logoImage)
UIView.animateWithDuration(0.25, animations: {
self.stackView.layoutIfNeeded()
})
2.删除subview
self.stackView.removeArrangedSubview(logoView)