nicklockwood/SwipeView

Auto Layout still required after executing -layoutSubviews

gestas-projects opened this issue · 2 comments

Hello,
on iPad2 7.1 I get this error:

*** Assertion failure in -[SwipeView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2935.137/UIView.m:8794
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. SwipeView's implementation of -layoutSubviews needs to call super.'

// SwipeView.h
// Version 1.3.2

How should i fix this?

same problem here. And only happens on iOS 7.

To fix this, in SwipeView.m add [self layoutIfNeeded] for layoutSubviews routine like below:

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self updateItemSizeAndCount];
    [self updateScrollViewDimensions];
    [self updateLayout];
    if (_pagingEnabled && !_scrolling)
    {
        [self scrollToItemAtIndex:self.currentItemIndex duration:0.25];
    }
    [self layoutIfNeeded]; // this line only serve the purpose of fixing ios 7 auto layout issue, but not sure why?
}

I think it has something to do with autoResizingMask. Any one got better idea?