Search code examples
xcodescrolluicollectionviewright-to-left

Maybe bug in Collection View, Horizontal scroll, development language RightToLeft


When you have a Collection view that scrolls horizontally, and you want to scroll programmatically for an item, you call:

scrollToItemAtIndexPath

When your Localization native development region is set to a language that is LeftToRight, everything works as expected. But when it set to a RightToLeft language, it takes an index path as it counted the index from the last item to the start, so you gets the item you didn't want! If you then set the semantic property of the collection view to Force Left To Right, it'll work as expected, but scrolls from left to right, and it not what I want...

I've set up an example project on GitHub... Let's see who can solve this!! =]

https://github.com/ybeapps/BugInUICollectionViewForIOS


Solution

  • At last, Apple solved the bug in iOS 11.0

    They asked me to test it in several beta versions (Some of them had a frightening behavior)

    I'm leaving the question and for reference and for backward compatibility