如何在应用程序运行时检测用户是否更改了 iPhone 系统语言设置? [英] How can I detect if a user has changed the iPhone system language settings while the app is running?

查看:20
本文介绍了如何在应用程序运行时检测用户是否更改了 iPhone 系统语言设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用这些语言更改作为我将要编写的代码中的触发器.

I am going to use these language changes as triggers in the code that I'm going to write.

例如:

if languageHasChanged() {
    //do something
}

推荐答案

注册 NSLocale.currentLocaleDidChangeNotification 通知.

NotificationCenter.default.addObserver(self, selector: #selector(localeChanged), name: NSLocale.currentLocaleDidChangeNotification, object: nil)

func localeChanged() {

}

这篇关于如何在应用程序运行时检测用户是否更改了 iPhone 系统语言设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆