如何刷新iPhone中的NSLocale?

我目前正在使用iPhone应用程序,使用NSLocale使当前货币符号正常工作,但当我按下主页按钮时,应用程序进入后台进程并更改货币(设置>>国际>> ​​Regionformat >>像美国,印度等…)以这种方式,然后从背景打开该应用程序货币符号没有改变,但我导航到另一个屏幕然后来到前一个屏幕只有货币改变,但我想当我从背景打开应用程序,然后货币符号自动更改。 如何解决这个问题? 我需要你的帮助

谢谢

我在这里试过代码:

NSLocale *theLocale = [NSLocale currentLocale]; Getdollarsymbol = [theLocale objectForKey:NSLocaleCurrencySymbol]; NSString *Code = [theLocale objectForKey:NSLocaleCurrencyCode]; 

请试试这段代码。 让我知道这是否有效,

-viewDidLoad:添加行:

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshCurrencySymbol) name:NSCurrentLocaleDidChangeNotification object:nil]; 

然后:

 -(void) refreshCurrencySymbol { NSLocale *theLocale = [NSLocale currentLocale]; NSString *symbol = [theLocale objectForKey:NSLocaleCurrencySymbol]; NSLog(@"Symbol : %@",symbol); NSString *code = [theLocale objectForKey:NSLocaleCurrencyCode]; NSLog(@"Code : %@",code); } 

谢谢。

以下内容如何:

 [NSLocale autoupdatingCurrentLocale] 

Apple文档提及

该对象始终反映当前用户的区域设置的当前状态。