animateWithDuration无效

需要在后面增加一句

1
[self.view layoutIfNeeded];

比如

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 __weak typeof(self) weakSelf = self;

[UIView animateWithDuration:0.2 animations:^{

weakSelf.progressLineWidth.constant=WIDTH;

[weakSelf.view layoutIfNeeded];

} completion:^(BOOL finished) {

weakSelf.progressLine.hidden=YES;

weakSelf.progressLineWidth.constant=0;

}];