gpt4 book ai didi

iphone - 无法以编程方式更改 MFMailComposer 语言?

转载 作者:可可西里 更新时间:2023-11-01 06:16:44 25 4
gpt4 key购买 nike

我正在尝试以编程方式更改 MFmailComposer 语言。最初,如果我选择“英语邮件”按钮首先,MFMailComposer 将以英语打开。现在,如果我选择“阿拉伯邮件”按钮,那么 MFMailComposer 将以英语而不是阿拉伯语打开。

这是我的 ViewController 的截图

enter image description here

Screen shot when English Button is selected

Screen shot when Arabic button is selected

那么,如何在不重启应用程序的情况下以编程方式更改 MFMailComposer 语言?

这是代码

- (IBAction)showInArabic:(id)sender 
{

[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"ar", nil] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self viewDidUnload];
[self viewDidLoad];
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
if ([mailClass canSendMail])
{
[self displayComposerSheet];

} else {

[self launchMailAppOnDevice];
}

} else {

[self launchMailAppOnDevice];
}
}
- (IBAction)showInEnglish:(id)sender
{
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];

NSArray *languages = [NSArray arrayWithObject:@"en"];
[[NSUserDefaults standardUserDefaults] setObject:languages forKey:@"AppleLanguages"];

[self viewDidUnload];
[self viewDidLoad];

Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));

if (mailClass != nil) {

if ([mailClass canSendMail]) {

[self displayComposerSheet];

} else {

[self launchMailAppOnDevice];
}

} else {

[self launchMailAppOnDevice];
}
}

最佳答案

目前似乎无法以编程方式更改 MFMailComposer 语言。默认设置为英语。

关于iphone - 无法以编程方式更改 MFMailComposer 语言?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10651708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com