检查 UIAlertView 是否可见

发布于 2024-08-14 00:47:12 字数 109 浏览 1 评论 0原文

我有一种情况,我想弹出一个警报视图,但显示警报视图的事件可能每 5 秒发生一次。我不想有一堆警报视图供用户单击“确定”,所以我想知道。

如何检查 UIAlertView 当前是否正在显示?

I have a situation where I would like to pop up an alert view, but the event that shows the alert view could occur as often as every 5 seconds. I'd rather not have a stack of alert views for the user to click OK on so I was wondering.

How do you check if a UIAlertView is currently showing?

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

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

发布评论

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

评论(1

放赐 2024-08-21 00:47:12

您可以保留对它的引用,也可以在警报委托中设置一个标志。当您打开警报时,将标志设置为 true,当警报调用其解除委托函数时,将其设置为 false。检查标志的状态以确定警报当前是否打开。

如果您认为有可能最终会收到一堆警报,您可能需要重新考虑您的设计。您的用户不会喜欢被一个又一个的警报对话框击中。

You could retain a reference to it or you could set a flag in your alert delegate. When you open the alert set the flag to true and when the alert calls its dismissal delegate function flip it to false. Check the state of the flag to determine whether an alert is currently open.

If you think it even possible you could end up with a stack of alerts you might want to rethink your design. Your users will not like being hit with alert dialog after alert dialog.

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