星五博客

在代码中修改AutoLayout约束

//遍历view约束,找到属于tableview的约束
NSArray* constrains = self.view.constraints;
for (NSLayoutConstraint* constraint in constrains) {
  if (constraint.secondItem == self.tableView) {
    if (constraint.firstAttribute ==NSLayoutAttributeBottom) {
      constraint.constant = 0.0;
    }
  }
}


IOS