SwipeView icon indicating copy to clipboard operation
SwipeView copied to clipboard

Auto Layout still required after executing -layoutSubviews

Open gestas-projects opened this issue 10 years ago • 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?

gestas-projects avatar Jan 19 '15 10:01 gestas-projects

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?

haojianzong avatar Jan 29 '15 08:01 haojianzong

@haojianzong good job

peppermints avatar Jun 17 '16 00:06 peppermints