iOS 遍历AutoLayout约束
//遍历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; } } }
Stay hungry,stay foolish.