Hossam Ghareeb Hossam Ghareeb - 7 months ago 39
Swift Question

Disable RTL direction for UICollectionView

I'm building a custom calendar view with

UICollectionView
. Everything is pretty well but when I tried to test when language is set to Arabic, the cells are listed from right to left. Is there a way to disable this in RTL mode.
I have checked the documentation but there is no such option.

Answer

You can disable it by setting view semantics property You have to set it on UICollectionView there is a property in UIView Class

semanticContentAttribute 

with following value

UISemanticContentAttributeUnspecified = 0,
UISemanticContentAttributePlayback, 
UISemanticContentAttributeSpatial, 
UISemanticContentAttributeForceLeftToRight,
UISemanticContentAttributeForceRightToLeft

enter image description here