3 回答
TA贡献1804条经验 获得超2个赞
只需将以下内容添加到屏幕上即可选择语言:
NSString *tempValue = //user chosen language. Can be picker view/button/segmented control/whatever. Just get the text out of it
NSString *currentLanguage = @"";
if ([tempValue rangeOfString:NSLocalizedString(@"English", nil)].location != NSNotFound) {
currentLanguage = @"en";
} else if ([tempValue rangeOfString:NSLocalizedString(@"German", nil)].location != NSNotFound) {
currentLanguage = @"de";
} else if ([tempValue rangeOfString:NSLocalizedString(@"Russian", nil)].location != NSNotFound) {
currentLanguage = @"ru";
}
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:currentLanguage, nil] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults]synchronize];
然后要求他们重新启动应用程序,该应用程序将使用其他语言。
希望能帮助到你
- 3 回答
- 0 关注
- 666 浏览
添加回答
举报