ps一下,由于autolayout设定了约束,但是想让一个View从一点到另外一点,代码中直接修改view的frame是行不通的
oginViewTopConstraint = [NSLayoutConstraint constraintWithItem:self.loginView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:20];//定义新约束
[self.view removeConstraint:self.topConstraint];//移除旧约束
[self.view addConstraint:loginViewTopConstraint];//添加新约束
[self.view layoutIfNeeded];//使约束生效