1

I'm animating a UITableViewCell the following way, first I enlarge it to show more details:

[NSObject pop_animate:^{
    cell.pop_springBounciness = 16;
    cell.pop_springSpeed = 6;
    cell.pop_spring.frame = CGRectMake(x, y, width, expandedHeight);
} completion:^(BOOL finished) {
}];

this works as expected, but when I try to shrink it again, I get an exception:

[NSObject pop_animate:^{
    cell.pop_springBounciness = 16;
    cell.pop_springSpeed = 6;
    cell.pop_spring.frame = CGRectMake(x, y, width, shrinkedHeight);
} completion:^(BOOL finished) {
}];

This is the exception I get:

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.

I guess the reason is because of the spring animation the cell's height gets below 0 - but how to avoid this?

swalkner
  • 16,679
  • 31
  • 123
  • 210

0 Answers0