gpt4 book ai didi

ios - 使用 UITouchTypeStylus 处理 Apple Pencil 触摸事件

转载 作者:行者123 更新时间:2023-11-29 12:02:18 25 4
gpt4 key购买 nike

我需要处理 UITouchTypeStylus 触摸事件的特定操作,并具有 View 中按钮的特定操作。

如果我用苹果铅笔点击按钮,这两个事件都会被触发。

让我知道,当用苹果铅笔点击按钮时,如何只触发 UITouchTypeStylus 触摸事件?或者如果我们触摸按钮或任何操作……即使是手写笔,如何处理。

最佳答案

最好的方法是创建一个 UIButton 子类,其中包含覆盖的 touchesBegan/Moved/Ended 方法和 block 或委托(delegate)方法来调用传递触摸类型。然后检查触摸类型并调用适当的功能。

关于ios - 使用 UITouchTypeStylus 处理 Apple Pencil 触摸事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36418553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com