ios - 防止IOS通知菜单下滑

标签 ios swift iphone xcode

在 iPhone 和 iPad 上,当您从屏幕顶部向下滑动手指时,通知菜单会显示时间和过去的通知。当我的应用程序在前台时,有没有办法避免这种情况发生?有没有我可以为我的应用程序激活的 Xcode 设置,或者我可以放入我的 viewController 的一行代码? 感谢您的帮助!

最佳答案

有一个名为 preferredScreenEdgesDeferringSystemGestures 的实例属性可以被覆盖。这不会禁用通知中心,但会强制用户滑动两次——第一次时,一个小标签将从屏幕顶部伸出。将以下代码添加到您的 View Controller :

override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
    return .top  //Or, return .all to "disable" the control center as well
}

关于ios - 防止IOS通知菜单下滑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58244388/

相关文章:

iphone - 如何从苹果 RSS 提要中识别 iOS 通用应用程序

ios - swift:更改 UIView 的大小

ios - 如何在 ios 中的数组中添加相机捕获图像

ios - 添加 UIImagePickerController 作为 subview

ios - Plist 和 Mobile Provisioning 文件加密

IOS。在不使用菜单显示的情况下将图像共享到 Instagram

swift - Swift 中的 UICollectionView 自定义布局

node.js - 将图像上传到 Node.js Express 服务器 Swift

ios - 如何制作无限的 UIScrollView?

iphone - 常规/组 UITableViewCell 中的字符数