문제

I cannot figure out how to set NSLayoutConstraint animation duration in iOS7. Here's my code:

self.loadingViewTop.constant = -[[UIScreen mainScreen] bounds].size.height;
self.loadingViewBottom.constant = [[UIScreen mainScreen] bounds].size.height;

[UIView animateWithDuration:30.0f animations:^{
    [self.loadingView setNeedsUpdateConstraints];
}];
도움이 되었습니까?

해결책

Oh you forget to call [self.view layoutIfNeeded]; inside animation block

다른 팁

The solution:

self.loadingViewTop.constant = -[[UIScreen mainScreen] bounds].size.height;
self.loadingViewBottom.constant = [[UIScreen mainScreen] bounds].size.height;

[UIView animateWithDuration:30.0f animations:^{
    [self.view layoutIfNeeded];
}];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top