I am getting this error on resetting the frame of collection view (summaryView) in this method
- (void)configureSubviews{
_close.frame = CGRectMake(rect.origin.x, 10 , 51, 35);
[_close setBackgroundImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateNormal];
[_close setBackgroundImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateSelected];
[_close setBackgroundImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateHighlighted];
[_close addTarget:self action:@selector(closeDetailView:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_close];
_dragger.frame = CGRectMake((rect.size.width-35)/2, 28, 23, 10);
_dragger.image = [UIImage imageNamed:@"summary_dragger_portrait.png"];
_draggerView.frame = CGRectMake(0, 0, rect.size.width, 40);
_contentView.frame = CGRectMake(0, 13, rect.size.width, rect.size.height);
[_summaryView.collectionViewLayout invalidateLayout];
_summaryView.frame = CGRectMake(0, 50, rect.size.width, rect.size.height-93);// exception occurs on this line
_borderView.frame = CGRectMake(0, 36, rect.size.width, 0.5);
actionX = rect.size.width-41;
}
Exception:
MyApp[2585:728612] * Assertion failure in -[UICollectionViewData validateLayoutInRect:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.60.12/UICollectionViewData.m:408 2016-08-11 11:22:05.175 MyApp [2585:728612] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'layout attributes for supplementary item at index path ( {length = 2, path = 0 - 0}) changed from index path: ( {length = 2, path = 0 - 0}); element kind: (SummarySuppView); frame = (6 0; 743 65); zIndex = -1; to index path: ( {length = 2, path = 0 - 0}); element kind: (SummarySuppView); frame = (6 0; 743 65); zIndex = -1; without invalidating the layout'
This method is called from animation block
UIView transitionWithView:self.view duration:0.15
options: (UIViewAnimationOptions)UIViewAnimationTransitionCurlUp
animations:^ {
[self layoutDataViewsForSize:listSize];
[self layoutSummaryViewsForSize:summarySize];
[_summaryView layoutSubviews]; // method call
}
completion:^(BOOL finished){
if (_filterActions.alpha==0) {
_filterActions.alpha= 1.0f;
}
}];