我创建了一个名为"Localizable.strings"的字符串文件,并为其添加了两种语言,如下所示:
"CONNECTIONERROR" = "Check that you have a working internet connection.";
"CONNECTIONERRORTITLE" = "Network error";
Run Code Online (Sandbox Code Playgroud)
我还将文件转换为Unicode UTF-8但是,当我创建这样的UIAlertView时:
UIAlertView *myAlert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"CONNECTIONERRORITLE",nil)
message:NSLocalizedString(@"CONNECTIONERROR",nil)
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
Run Code Online (Sandbox Code Playgroud)
警报视图仅显示关键文本,而不显示值.例如,如果我将UITextviews文本设置为NSLocalizedString(@"CONNECTIONERROR",nil),则它可以工作,但警报视图仅显示密钥.谁知道什么是错的?