跟踪 SFSafariViewController 上的触摸事件

时间:2021-06-24 22:52:21

标签: ios swift xcode sfsafariviewcontroller uievent

我无法在 SFSafariViewController 上拦截触摸事件。

这是我的 Main.swift 文件

UIApplicationMain(CommandLine.argc,CommandLine.unsafeArgv,
 NSStringFromClass(MyApplication.self), NSStringFromClass(AppDelegate.self))

另外,这里是 UIApplication 的子类

class MyApplication: UIApplication
{
    override func sendEvent(_ event: UIEvent)
    {
        super.sendEvent(event)
        let allTouches = event.allTouches;
        if (allTouches != nil && allTouches?.count > 0)
        {
            print("reset called")
            MyTimeManager.sharedTimeManager.resetActivityTimer()
        }
    }
}

我的问题是当用户在 SFSafariViewController 的实例中时;上面定义的 sendEvent func 没有被调用。

有人知道如何实现吗?

0 个答案:

没有答案
相关问题