The best approach to programmatically changing direction Xib

I have an application that has a settings page where the user can change the language of the application. Eventually, the direction of the xibs will change. To explain a little more, if the language is English, for example, the direction will be LTR; However, if it is Arabic, it will be RTL.

Question

What is the best approach to achieve this?

Approaches with problems

  • NSUserDefaults: Setting the language to "ar-SA" changes the direction successfully, but only when called in the main class. When I do this at runtime, the application must be restarted for it to take effect. Even if there is a way to restart the application, it is not recommended and the application may be rejected.
  • Multiple xibs: This approach will work eventually, but I have to create two Xibs files for each UIView . If this is the only solution, can I create two UIViews in the same xib file to avoid confusion?

Any other tips?

thank

+3


source to share


1 answer


I highly recommend switching the language switcher in the app and directing your users to system wide language and regional preferences where they can set their language.



Trying to provide roll support in your application will lead to an endless number of problems and errors for your users, some of which you can't even get around. Both approaches you provide are already sub-pairs, and the second sounds like a maintainability nightmare.

+1


source







All Articles