代码中更改AutoLayout约束

原文地址:http://blog.sina.com.cn/s/blog_6291e42d0102uzav.html

//遍历footerview约束(一般高,宽)

            NSArray* constrains = self.footerView.constraints;

            for (NSLayoutConstraint* constraint in constrains) {

                if (constraint.firstAttribute == NSLayoutAttributeHeight) {

                    constraint.constant = 0.0;

                }

            }

            

           //遍历view约束,找到属于tableview的约束

            NSArray* constrains2 = self.view.constraints;

            for (NSLayoutConstraint* constraint in constrains2) {

                if (constraint.secondItem == self.tableView) {

                    //据底部0

                    if (constraint.firstAttribute ==NSLayoutAttributeBottom) {

                        constraint.constant = 0.0;

                        

                    }

                }

            }


你可能感兴趣的:(资料,iOS)