大家好,又见面了,我是全栈君。
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)
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/115532.html原文链接:https://javaforall.cn