Presets,
i have collectionViewFlowLayout subclass with
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
return YES;
}
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
NSArray *arr = [super layoutAttributesForElementsInRect:rect];
BBLog(@"ARRA:%@", arr);
for (UICollectionViewLayoutAttributes *attr in arr) {
if (CGAffineTransformIsIdentity(attr.transform)) {
attr.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
}
}
return arr;
}
CollectionView rotate to upside down scroll with
self.collectionView.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
But even if jus use native collectionViewFlowLayout without subclassing, a git this error
Problem
I have two messages and more in chat, but when scroll at bottom (top normally) disappear second item.
layoutAttributesForElementsInRect for given rect return two attributes for two indexPaths 0-0 and 0-1, but delegate method
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
called only for indexPath 0-0
Here images
UPDATE So i found WHY it's happen - this line code
attr.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
Look if remove transform
You think the object disappears when you aren’t looking. What could be happening is that the universe decoheres that you’re in into 2 branches - one with you and the other with the object. If and when the object returns, what is happening is a rejoining of the 2 branches into on
When disappearing object phenomena (DOP) occur, a lot of people blame a poltergeist, if only half seriously. A poltergeist is usually defined as a mischievous or noisy spirit. Poltergeist activity often includes unexplained noises, music, smells, and movement of objects.
Disappearing Object Phenomenon 1 Absentmindedness. When examining such occurrences as DOP, you must first consider the most ordinary possibility: that the person simply misplaced the object or forgot where she put it. 2 The Borrower. ... 3 Poltergeist. ... 4 Temporary Invisibility. ... 5 Dimensional Shift. ...
I have been psychic since childhood, so I have learned to live with this type of occurrence. Just ma Have you ever dropped something and it completely disappears immediately? yes actually. It was a pillow. It fell off my bed when I was waking up. And it literally disappeared. I have no idea where it went. it bothers me to think about it actually.
I am not entirely sure, but I think that, when You are subclassing the UICollectionViewFlowLayout, You are not supposed to modify the attributes directly, but to make a copy of the attributes, modify it instead and return it.
Short explanation of the top statement : You will have to subclass the UICollectionViewFlowDelegate ( the parent of UICollectionViewDelegateFlowLayout ) and than make your own attributes and modify them as You wish, but this will require of to implement a lot more custom logic.
Also look if You are getting any errors or warnings in the console.
Check out this question : Warning: UICollectionViewFlowLayout has cached frame mismatch for index path 'abc'
Hope that I was at least a little helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With