美文网首页
监听截屏录屏

监听截屏录屏

作者: kayling | 来源:发表于2021-05-10 09:18 被阅读0次
/// 监听录屏截屏
    public func monitorRecordVideoAndScreenshot() {
        if #available(iOS 11.0, *) {
            //录屏通知
            NotificationCenter.default.addObserver(self, selector: #selector(showWarningView_recordVideo), name: UIScreen.capturedDidChangeNotification, object: nil)
        }
        
        //截屏通知
        NotificationCenter.default.addObserver(self, selector: #selector(showWarningView_screenshot), name: UIApplication.userDidTakeScreenshotNotification, object: nil)
    }
/// 监测当前设备是否处于录屏状态
    public func vcIsCaptured(){
        //监测当前设备是否处于录屏状态
        if #available(iOS 11.0, *) {
            let sc = UIScreen.main
            if sc.isCaptured {
                showWarningView_recordVideo()
            }
        }
    }

相关文章

网友评论

      本文标题:监听截屏录屏

      本文链接:https://www.haomeiwen.com/subject/ztbbdltx.html