0
votes

I am creating an app that will be in English and Arabic. I am using my own localization system because I want to allow users to switch languages themselves from within the app and while the app is running (I am not aware of a way how to do this official Apple way). I would like to switch entire app to right-to-left when user picks arabic language, i.e. switch trailing and leading, text alignment etc.

Is this even possible?

EDIT: I am targeting iOS 7+

1
Did you find any solution for this ? Thanks !namanhams
Sadly, no. We decided to drop this featureLope

1 Answers

0
votes

Yes, this is possible. From what I am understanding you want to move all of your components to the opposite side and also the text should be written from the right, right?

First of all, you have to set your language to the "AppleLanguage" key in user defaults:

NSUserDefaults.setObject(["ar"], forKey: "AppleLanguage")

Then you have to use auto layout. By default auto layout detects the region depending on the language chosen and when you've set leading and trailing spaces correctly, it will change the position of your text fields for example. If you want some of your components to stay on the same place, you have to use "left" instead of "leading".