iOS开发之touchesCancelled

    xiaoxiao2025-02-24  28

    touchesCancelled:

    override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { }

    当我们正在触摸屏幕的时候,如果出现了低电量、有电话呼入等等这样的系统事件时候,低电量或者电话的窗口会置为前台,这个时候touchesCancelled方法就会被调用。

    因为在软件运行过程中不可避免的会发生由iOS系统发出的一些事件,导致触摸事件的中断,所以一般建议要实现touchesCancelled这个方法,一般情况下直接调用touchesEnd即可。

    touchesCancelled:Sent to the responder when a system event (such as a low-memory warning) cancels a touch event.
    转载请注明原文地址: https://ju.6miu.com/read-1296618.html
    最新回复(0)