UICollectionViewLayout has a property called flipsHorizontallyInOppositeLayoutDirection. If this is set to YES then a RTL collectionView’s contentOffset behaves like it does in LTR. In other words, the first item is at contentOffset 0. In this case, the existing logic for ASDisplayShouldFetchBatchForScrollView works in RTL.
If you don’t override flipsHorizontallyInOppositeLayoutDirection to be YES, then it means that in RTL languages the first item in your collectionView will actually be at x offset collectionView.contentSize.width - collectionView.frame.size.width. As you scroll to the right, the content offset will decrease until you reach the end of the data at a content offset of 0,0. In this case, ASDisplayShouldFetchBatchForScrollView needs to know that you are in RTL and the layout is not flipped. It can then use the contentOffset as the remainingDistance to determine when to fetch.
UICollectionViewLayout
has a property calledflipsHorizontallyInOppositeLayoutDirection
. If this is set toYES
then a RTL collectionView’s contentOffset behaves like it does in LTR. In other words, the first item is at contentOffset 0. In this case, the existing logic forASDisplayShouldFetchBatchForScrollView
works in RTL.If you don’t override
flipsHorizontallyInOppositeLayoutDirection
to beYES
, then it means that in RTL languages the first item in your collectionView will actually be at x offsetcollectionView.contentSize.width - collectionView.frame.size.width
. As you scroll to the right, the content offset will decrease until you reach the end of the data at a content offset of 0,0. In this case,ASDisplayShouldFetchBatchForScrollView
needs to know that you are in RTL and the layout is not flipped. It can then use the contentOffset as theremainingDistance
to determine when to fetch.