如何在您的应用程序中禁用 iOS 通知中心? [英] How can you disable the iOS Notification Center within your App?

查看:26
本文介绍了如何在您的应用程序中禁用 iOS 通知中心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你有一个全屏的 iOS 应用,并且你想防止通知中心被下拉,你能和如何?

If you have a full screen iOS app and you want to prevent the notification center from being pulled down, can you and how?

还可以在加载应用程序时阻止显示通知警报或横幅吗?(我认为这是不可能的,但想问问以防万一.)

Also can you block notification alerts or banners from displaying while your app is loading? (I think this is a no way for sure but wanted to ask just in case.)

推荐答案

根据我的经验,全屏应用 (statusBarHidden = YES) 的默认通知中心行为略有不同:向下滑动之前被状态栏占据的区域只会显示一个小标签.只有滑动选项卡才会显示通知中心.到目前为止,这足以防止我意外激活.

It has been my experience that fullscreen apps (statusBarHidden = YES) have a slightly different notification center behavior by default: Swiping down over the area previously occupied by the status bar will only show a little tab. Only swiping the tab will then show the notification center. This has been enough to prevent accidental activation for me so far.

目前,没有用于操作通知中心行为的公共 API.我认为应用程序不太可能永远能够阻止通知的出现,应用程序阻止通知中心出现的可能性也很小.iOS 是以开发者自由为代价的一致的用户体验.如果我是一个意外的用户,我可以看到对这种功能感到沮丧.

Currently, there is no public API for manipulating the behavior of the notification center. I am of the opinion that it's not likely that an app will ever be able to block a notification's appearance, and only slightly less unlikely that an app would be able to prevent the notification center from appearing. iOS is all about a consistent user experience experience at the price of developer freedom. I could see being frustrated by this kind of functionality if I were an unexpecting user.

尽管如此,未记录的 API 总会有阴暗面.如果您可以在越狱设备上使用这些设备来实现一些聪明,我不会感到惊讶,但这不是我的杯中茶.

All that said, there is always the dark-side of undocumented APIs. I would not be surprised if you could pull off some cleverness using those on a jailbroken device, but that's not my cup-o'-tea.

这篇关于如何在您的应用程序中禁用 iOS 通知中心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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