ios9中 UIStackView的使用
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)
时间: 2024-10-11 05:08:55