Change frame programmatically with auto layout

前端 未结 4 1853
春和景丽
春和景丽 2020-12-02 14:23

I have a UITableView with Auto Layout and I need to reduce the height when the GADBannerView appears at the bottom of the screen.

Unfortunat

4条回答
  •  醉话见心
    2020-12-02 15:06

    You can find out constraint like that

    extension UIView {
        var heightConstaint: NSLayoutConstraint? {
            get {
                for constraint: NSLayoutConstraint in constraints {
                    if constraint.firstAttribute == .height {
                        if constraint.relation == .equal {
                            return constraint
                        }
                    }
                }
                return nil
            }
    
            set{
                setNeedsLayout()
            }
        }
    }
    

提交回复
热议问题