Change language in iOS app in auto layout

In our application, we must support English and Arabic, but the option to change the language is available in the application itself. Previously, we processed right to left and left to right language changes in the code.

Starting with iOS 9, the auto-layout user interface will be handled properly when changing the language in iPhone settings.

According to my requirement, we changed the language in the application and directly updated the AppleLanguages ​​key. But the storyboard is not being updated properly. As soon as I force to exit the application and restart it, then it works fine.

I need clarification, Is there any solution to change this (language in the application) without restarting the application? If “No”, to restart the application, can I show a warning and exit the application (using exit (0))? Will this be approved by the app review team?

+1
source share
1 answer

I need clarification on whether there is any solution to change this (language in the application) without restarting the application?

Yes there is! if you have already processed the language change by checking the global key AppleLanguagesand using the automatic layout, this should be easy to make such functionality.

lproj, , Swizzling .

, (It ). , :

enter image description here


, Localize-Swift ( ).

, .

+2

Source: https://habr.com/ru/post/1017128/


All Articles