Open esetnik opened 8 years ago
Hello @esetnik, thanks for the report. I shall look into it, but cannot guarantee it is going to be soon... If you find a solution please feel free to submit a PR
I also filed a radar with Apple. I think this is an iOS bug because I get a similar crash when using the superclass flow layout. On Sun, Jan 3, 2016 at 2:53 AM Giovanni Lodi notifications@github.com wrote:
Hello @esetnik https://github.com/esetnik, thanks for the report. I shall look into it, but cannot guarantee it is going to be soon... If you find a solution please feel free to submit a PR
— Reply to this email directly or view it on GitHub https://github.com/mokagio/UICollectionViewLeftAlignedLayout/issues/9#issuecomment-168475731 .
@esetnik Hello! Is any update for this circumstance? If I don't copy attribute, it would not cause EXC_BAD_ACCESS. But xcode will told me warning said "UICollectionViewFlowLayout has cached frame mismatch".
Thanks for your help!!
UICollectionViewLayoutAttributes* currentItemAttributes = [super layoutAttributesForItemAtIndexPath:indexPath]; delete copy fix this
I get the same "loop" that leads to the EXC_BAD_ACCESS bug on iOS 9.3 but not on iOS 10+
If I comment out this overwritten method in UICollectionViewLeftAlignedLayout.m then it works on iOS 9 (layout is left aligned) but the layout is not left aligned on iOS 10.
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
{
NSArray *originalAttributes = [super layoutAttributesForElementsInRect:rect];
NSMutableArray *updatedAttributes = [NSMutableArray arrayWithArray:originalAttributes];
for (UICollectionViewLayoutAttributes *attributes in originalAttributes)
{
if (!attributes.representedElementKind)
{
NSUInteger index = [updatedAttributes indexOfObject:attributes];
updatedAttributes[index] = [self layoutAttributesForItemAtIndexPath:attributes.indexPath];
}
}
return updatedAttributes;
}
Anyone found a way around this for iOS 9? Anyone knows how to at compile time exclude code based on iOS version?
Thanks GMCoder.
Reproduce:
IOS 9, set estimatedItemSize property
I am getting a crash when using UICollectionViewLeftAlignedLayout on line 47. This only occurs if I set estimatedItemSize to use dynamic sizing.
NSArray *originalAttributes = [super layoutAttributesForElementsInRect:rect];