سؤال

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