Sorry, everything, but I found the reason and worked.
This only happens on the device, not on the simulator.
Look at the three CGRects
iPhone 5s
(CGRect) oldFrame = (origin = (x = -0.000000000000056843418860808015, y = 0), size = (width = 320.00000000000006, height = 314.00000000000006))
iPhone 5C
(CGRect) oldFrame = (origin = (x = 0, y = 0), size = (width = 320, height = 314))
Intel Core Simulator
(CGRect) oldFrame = (origin = (x = 0, y = 0), size = (width = 320, height = 314))
For all of them, I apply rotation conversion through
CGAffineTransformMakeRotation((CGFloat)M_PI)
First it is on the iPhone 5S ARM Apple A7 CPU
The second is on the iPhone 5C ARM Apple A6 CPU
Thirdly, it is on a simulator on an Intel Core iX processor.
So my job is:
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewLayoutAttributes *retAttr = [super layoutAttributesForItemAtIndexPath:indexPath]; if (CGAffineTransformIsIdentity(retAttr.transform)) { retAttr.transform = CGAffineTransformMakeRotation((CGFloat)M_PI); } CGRect oldFrame = retAttr.frame; oldFrame.origin.x = retAttr.frame.origin.x > 0 ?: 0; retAttr.frame = oldFrame; return retAttr; }
Dmitry Nelepov
source share