How to differentiate whether a user is tapping the screen with his finger or an apple pencil?

前端 未结 2 1807
走了就别回头了
走了就别回头了 2020-12-10 17:20

The App supports iPad Pro and it has to work with the Apple Pencil. What I would like to do is to differentiate whether the user is using the Apple Pencil or his finger.

2条回答
  •  不知归路
    2020-12-10 17:41

    The UITouch class in iOS 9.1 has a touch property which returns the type:

    typedef enum {
        UITouchTypeDirect,
        UITouchTypeIndirect,
        UITouchTypeStylus       // THIS ONE
    } UITouchType;
    

提交回复
热议问题