切换设置捆绑开关时显示警报

发布于 2024-12-21 01:23:46 字数 47 浏览 2 评论 0原文

我想在切换 iPhone 应用程序设置包的开关时显示警报。谁能帮我看看该怎么做。

I want to show an alert when i toggle the switch of the iPhone application settings bundle. Can anyone please help me out how to do it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坐在坟头思考人生 2024-12-28 01:23:46

当 Settings.app 中的开关切换时,您的应用程序将处于后台。但是,如果您会阅读开发者文档,您会看到有一个可供您订阅的 NSUserDefaultsDidChangeNotification ,并且当应用程序返回前台时显示警报。

阅读文档并展示更多的研究成果确实有帮助,这是开发人员每天所做的事情。

When a switch in Settings.app is toggled, your app is in the background. However, if you would have read the Developer documentation you would have seen that there is a NSUserDefaultsDidChangeNotification available that you can subscribe to and show your alert when the app is back in the foreground.

Reading the documentation and showing a little more research effort really helps, it's what developers do every day.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文