how to change Application language on run time using Two Button in iphone SDK?(如何使用 iphone SDK 中的两个按钮在运行时更改应用程序语言?)
问题描述
我正在 ios 平台上构建一个项目,并希望在此应用程序中使用两种语言并且还想要.用户可以在运行时更改语言假设我们可以使用两个语言按钮按钮 1 用于英语,按钮 2 用于德语,用户可以随时使用这些按钮更改应用程序语言.任何帮助或教程
i am building up a project in ios platform and want to use two language in this application and also want . the user can change the language on Runtime suppose we can take two language button button 1 for english and button 2 for german and the user can change the application language at any time by using these button . any help or tutorials
提前致谢
推荐答案
假设您已为英语和德语创建本地化,您的应用将使用设置中选择的语言(这是首选选项).
Assuming that you have created localizations for English and German, your app will use the language selected in Settings (this is the preferred option).
如果您想直接从应用程序设置语言:
If you want to set the language directly from your application:
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
只会将您的应用程序的语言设置为英语(对于德语,我假设键是de").您还应该:
will set the language for your application only to English (for German, I assume the key is "de"). You should also:
[[NSUserDefaults standardUserDefaults] synchronize];
这在您的应用程序重新启动之前不会生效.
This will not take effect until your application restarts.
这篇关于如何使用 iphone SDK 中的两个按钮在运行时更改应用程序语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 iphone SDK 中的两个按钮在运行时更改应用程序语言?


基础教程推荐
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01