我有一个像这样的 UITableView
-
我正在使用 UIScrollView 的委托(delegate)
中的动画调整此 tblViewTopConstraint
-
- (void) scrollViewDidScroll:(UIScrollView *)scrollView
动画代码 -
[self.tblViewTopConstraint setConstant:45.0f];
[UIView animateWithDuration:0.4f delay:0.f options:UIViewAnimationOptionCurveEaseOut animations:^{
[self.tblView.superview layoutIfNeeded];
} completion:^(BOOL finished) {
}];
动画工作正常,但如果我向上/向下滚动 UITableView 5-6 次,它会突然抛出此崩溃 -
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:<NSAutoresizingMaskLayoutConstraint:0xa75abb0 h=--& v=--& XYZCustomCell:0xb4c6f00.width == UITableViewWrapperView:0xb4bb710.width> view:<UITableViewWrapperView: 0xb4bb710; frame = (0 0; 320 459); autoresize = W+H; layer = <CALayer: 0xb4ca150>>'
最佳答案
错误表明,导致崩溃的约束是宽度约束:
constraint:<NSAutoresizingMaskLayoutConstraint:0xa75abb0 h=--& v=--& XYZCustomCell:0xb4c6f00.width == UITableViewWrapperView:0xb4bb710.width>
所以我认为您的问题不在于动画或特定约束。
关于ios - 动画 UITableView 自动布局顶部约束导致崩溃,任何线索?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21431347/