If layout is vertical and the desires cell width returned by the delegate is greater than the view's width, then there will be an infinite loop while trying to lay things out. I tracked it down to here and made the following change. The view will get cut off, but the infinite loop is avoided:
(void) fixDesiredCellSizeForWidth: (CGFloat) width
{
// Much thanks to Brandon Sneed (@bsneed) for the following new algorithm, reduced to two floating-point divisions -- that's O(1) folks!
CGFloat w = floorf(width - _leftPadding - _rightPadding);
CGFloat dw = floorf(_desiredCellSize.width);
CGFloat multiplier = floorf( w / dw );
// CHANGED: to avoid infinite loop
if (0 == multiplier)
multiplier = 1;
// CHANGED: end changes
If layout is vertical and the desires cell width returned by the delegate is greater than the view's width, then there will be an infinite loop while trying to lay things out. I tracked it down to here and made the following change. The view will get cut off, but the infinite loop is avoided:
(void) fixDesiredCellSizeForWidth: (CGFloat) width { // Much thanks to Brandon Sneed (@bsneed) for the following new algorithm, reduced to two floating-point divisions -- that's O(1) folks! CGFloat w = floorf(width - _leftPadding - _rightPadding); CGFloat dw = floorf(_desiredCellSize.width); CGFloat multiplier = floorf( w / dw );
// CHANGED: to avoid infinite loop if (0 == multiplier) multiplier = 1; // CHANGED: end changes
_actualCellSize.width = floorf( w / multiplier ); _actualCellSize.height = _desiredCellSize.height; }