<legend id='G8pNk'><style id='G8pNk'><dir id='G8pNk'><q id='G8pNk'></q></dir></style></legend><tfoot id='G8pNk'></tfoot>

  1. <i id='G8pNk'><tr id='G8pNk'><dt id='G8pNk'><q id='G8pNk'><span id='G8pNk'><b id='G8pNk'><form id='G8pNk'><ins id='G8pNk'></ins><ul id='G8pNk'></ul><sub id='G8pNk'></sub></form><legend id='G8pNk'></legend><bdo id='G8pNk'><pre id='G8pNk'><center id='G8pNk'></center></pre></bdo></b><th id='G8pNk'></th></span></q></dt></tr></i><div id='G8pNk'><tfoot id='G8pNk'></tfoot><dl id='G8pNk'><fieldset id='G8pNk'></fieldset></dl></div>

      <bdo id='G8pNk'></bdo><ul id='G8pNk'></ul>
  2. <small id='G8pNk'></small><noframes id='G8pNk'>

    1. 在自动布局中处理 iOS 应用程序中的语言更改

      时间:2023-09-09

      <small id='IhzZU'></small><noframes id='IhzZU'>

        <bdo id='IhzZU'></bdo><ul id='IhzZU'></ul>

            <legend id='IhzZU'><style id='IhzZU'><dir id='IhzZU'><q id='IhzZU'></q></dir></style></legend>
            • <i id='IhzZU'><tr id='IhzZU'><dt id='IhzZU'><q id='IhzZU'><span id='IhzZU'><b id='IhzZU'><form id='IhzZU'><ins id='IhzZU'></ins><ul id='IhzZU'></ul><sub id='IhzZU'></sub></form><legend id='IhzZU'></legend><bdo id='IhzZU'><pre id='IhzZU'><center id='IhzZU'></center></pre></bdo></b><th id='IhzZU'></th></span></q></dt></tr></i><div id='IhzZU'><tfoot id='IhzZU'></tfoot><dl id='IhzZU'><fieldset id='IhzZU'></fieldset></dl></div>
              <tfoot id='IhzZU'></tfoot>
                <tbody id='IhzZU'></tbody>
                本文介绍了在自动布局中处理 iOS 应用程序中的语言更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在我们的应用程序中,我们必须支持英语和阿拉伯语,但应用程序本身提供了语言更改选项.之前我们已经处理了代码中从右到左和从左到右的语言变化.

                从 iOS 9 开始,设计的带有自动布局的 UI 将得到妥善处理,同时更改 iPhone 设置中的语言.

                根据我的要求,我们更改了应用程序中的语言并直接更新了AppleLanguages"键.但是故事板没有正确更新.一旦我强制退出应用程序并重新启动它,它就可以正常工作了.

                我需要澄清一下,是否有任何解决方案可以在不重新启动应用程序的情况下更改此(应用程序内的语言)?如果否,对于重新启动应用程序,我可以显示警报并退出应用程序(使用 exit(0))吗?这将得到应用审核团队的批准吗?

                解决方案

                我需要澄清一下,是否有任何解决方案可以改变这一点(应用内的语言)无需重新启动应用?

                是的,有!如果您已经通过检查 AppleLanguages 全局键并使用自动布局来处理更改语言,那么执行这样的功能应该很容易.

                解决方案是切换 lproj 包以便在不重新启动应用程序的情况下对其进行本地化,您应该使用 Method Swizzling 来实现它.

                我建议检查使用

                <小时>

                另外,您可能想查看 Localize-Swift 库(实际上,我没有不要使用它).

                希望这会有所帮助.

                In our app, we have to support English and Arabic languages but the language changing option is available within the app itself. Earlier we have handled the right to left and left to right language changes in code.

                From iOS 9 onwards, designed the UI with auto layout will be handled this properly, while changing the language in iPhone settings.

                As per my requirement, we have changed the language within the app and updated the "AppleLanguages" key directly. But the storyboard is not updating properly. Once I force quit the app and relaunch it, then it working fine.

                I need clarifications in that, Is there any solution to change this (language within the app) without restarting the app? If No, for restarting the app, Can I show an Alert and quit the app (by using exit(0))? Is this will approved by app review team?

                解决方案

                I need clarifications in that, Is there any solution to change this (language within the app) without restarting the app?

                Yes, there is! if you are already handled changing the language by checking AppleLanguages global key and using Auto Layout, it should be easy to do such a functionality.

                The solution would be switching the lproj bundle in order to get it localized without restarting the app, you should do Method Swizzling to achieve it.

                I'd recommend to check Working with Internationalization and Localization in swift article, it will guides you clearly to do it from scratch (It works fine for me). After following along with it, the output should be similar to:


                Also, you might want to check Localize-Swift library (Actually, I didn't use it).

                Hope this helped.

                这篇关于在自动布局中处理 iOS 应用程序中的语言更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:自动布局、屏幕旋转和 UIView 动画 下一篇:dequeueReusableCell 打破了cliptobounds

                相关文章

                    <bdo id='awFsj'></bdo><ul id='awFsj'></ul>

                  <small id='awFsj'></small><noframes id='awFsj'>

                  <legend id='awFsj'><style id='awFsj'><dir id='awFsj'><q id='awFsj'></q></dir></style></legend>
                1. <tfoot id='awFsj'></tfoot>
                  1. <i id='awFsj'><tr id='awFsj'><dt id='awFsj'><q id='awFsj'><span id='awFsj'><b id='awFsj'><form id='awFsj'><ins id='awFsj'></ins><ul id='awFsj'></ul><sub id='awFsj'></sub></form><legend id='awFsj'></legend><bdo id='awFsj'><pre id='awFsj'><center id='awFsj'></center></pre></bdo></b><th id='awFsj'></th></span></q></dt></tr></i><div id='awFsj'><tfoot id='awFsj'></tfoot><dl id='awFsj'><fieldset id='awFsj'></fieldset></dl></div>