📜  如何更改stackview swift代码示例的背景颜色

📅  最后修改于: 2022-03-11 15:00:59.736000             🧑  作者: Mango

代码示例1
extension UIStackView {
    func addBackground(color: UIColor) {
        let subView = UIView(frame: bounds)
        subView.backgroundColor = color
        subView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        insertSubview(subView, at: 0)
    }
}