I have an app that supports 2 languages, English and Arabic. English is left to right & Arabic is right to left.
I have a controller named LanguageViewController
. There are two buttons in it: Arabic & English. When a user clicks on "Arabic" the language of my App changes from English to Arabic. I use auto layout in my project.
When the language is changed, I expect my object's position be mirrored at the same time. but it doesn't & when I close my App and run again, the object's position are mirrored correctly.
In Question: How to force "Respect Language Direction" from RTL to LTR and vice versa @Raz had the same problem. but I don't want to build a new storyBoard. When the language is changed from En
to Ar
and you quit the App the value of userInterfaceLayoutDirection
is change from UIUserInterfaceLayoutDirectionLeftToRight
to UIUserInterfaceLayoutDirectionRightToLeft
. I used NsLog
to see the value of userInterfaceLayoutDirection
. When I press the "Arabic" button the value doesn't change,bbut when I run again the value is changed. My question is how to force change userInterfaceLayoutDirection
without quitting and without loading new storyboard?
How exactly are you changing the application's preferred language with your buttons?
The userInterfaceLayoutDirection of an app is set once at launch time. There is currently no way to change it while an app is running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With