UICollectionView setContentOffset decimal point problem

Greetings,
I have a UICollectionView with frame:(0 0; 200 71.75),then I override the delegate method:
Code Block
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
/* same as collectionView's size */
return CGSizeMake(CGRectGetWidth(self.frame), CGRectGetHeight(self.frame));
}

I want the collectionView to display it's second item when it appears, so I did this:

Code Block
- (void)layoutSubviews {
[super layoutSubviews];
self.collectionView.frame = self.bounds;
if (!_hasLoaded) {
_hasLoaded = YES;
CGPoint p = CGPointMake(0, CGRectGetHeight(self.frame));
[self.collectionView setContentOffset:p];
}
}

After setting the contentOffset, then the delegate method
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
will call.

Notice!!!

I make a break point in this method, and I get this:
Code Block
(lldb) po scrollView
<UICollectionView: 0x11e0bb800; frame = (0 0; 200 71.75);
clipsToBounds = YES; gestureRecognizers = <NSArray: 0x2802ed950>;
layer = <CALayer: 0x280c23cc0>;
contentOffset: {0, 71.666666666666671};
contentSize: {200, 645.75};
adjustedContentInset: {0, 0, 0, 0}; layout: <UICollectionViewFlowLayout: 0x11dd52a40>;
dataSource: <PCBannerView: 0x11dd52880; frame = (87.5 0; 200 71.75); layer = <CALayer: 0x280c23be0>>>


I wonder why the contentOffset.y is different.
Who changes 71.75 to 71.666666666666671.
If the collectionView's height is an integer, the values are same.
Who can tell me the reason please.

My device info :
iPhoneX
version:13.7

Thanks
OK,I find a similar problem on stackoverflow.

Maybe we should use CGRectIntegral or .integral when using fractional points.

UICollectionView setContentOffset decimal point problem
 
 
Q