Don't set cell node frames during measure, set them just before returning the cell size to UITableView/UICollectionView

This commit is contained in:
Adlai Holler
2015-10-09 19:51:12 -07:00
parent ca5780f6f4
commit e716ccb580
3 changed files with 13 additions and 6 deletions

View File

@@ -423,7 +423,12 @@ static BOOL _isInterceptedSelector(SEL sel)
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return [[_dataController nodeAtIndexPath:indexPath] calculatedSize];
ASCellNode *node = [_dataController nodeAtIndexPath:indexPath];
CGSize size = node.calculatedSize;
if (!CGSizeEqualToSize(size, node.frame.size)) {
node.frame = CGRectMake(0, 0, size.width, size.height);
}
return size;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView