我通过以下方式为UITableViewCell制作动画,首先我将其放大以显示更多细节:
[NSObject pop_animate:^{
cell.pop_springBounciness = 16;
cell.pop_springSpeed = 6;
cell.pop_spring.frame = CGRectMake(x, y, width, expandedHeight);
} completion:^(BOOL finished) {
}];
这可以按预期工作,但当我再次尝试缩小它时,我得到一个例外:
[NSObject pop_animate:^{
cell.pop_springBounciness = 16;
cell.pop_springSpeed = 6;
cell.pop_spring.frame = CGRectMake(x, y, width, shrinkedHeight);
} completion:^(BOOL finished) {
}];
这是我得到的例外:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x15b5de60 h=-&- v=-&- UITableViewCellScrollView:0x1536f120.height == TransactionCell:0x1536ef50.height - 0.264848>",
"<NSAutoresizingMaskLayoutConstraint:0x15b5e4d0 h=--& v=--& V:[TransactionCell:0x1536ef50(0.163815)]>"
)
Will attempt to recover by breaking constraint
<NSAutoresizingMaskLayoutConstraint:0x15b5de60 h=-&- v=-&- UITableViewCellScrollView:0x1536f120.height == TransactionCell:0x1536ef50.height - 0.264848>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
我猜原因是因为弹簧动画的单元格高度低于0 - 但是如何避免这种情况呢?