Search code examples
iosobjective-cmultilingual

LTR To RTL Using same xib in objective c


I am stuck to one point i want to develop a app that support LTR and RTL both but i don't want to create two .xib for LTR and RTL.

So can any one provide me any method avalable fot LTR to RTL using same xib.

thank you in advance.


Solution

  • You can do this by changing the semantics

       self.anyView.semanticContentAttribute = .forceLeftToRight
    

    OR

       self.anyView.semanticContentAttribute = .forceRightToLeft
    

    In objective-c

     self.anyView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
    

    Or

     self.anyView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
    

    see also this demo : RTLDemo