UIView do not react on Apple Pencil

╄→гoц情女王★ 提交于 2019-12-25 04:34:21

问题


In my app some of UIViews don't react on Apple Pencil. When I make touch by finger, all works fine. I supposed that this might be caused by adding new property type in iOS 9. And I tried to change the type of touches:

touch.type = UITouchTypeDirect;

But this is readonly property. Does exist any way to make equal touch by finger and touch by Apple Pencil?

How do I make my app react on Apple Pencil?


回答1:


UITouch class determines whether the touch is made by a stylus or by a finger, as stylus have a pinpoint touch and finger has a soft corner touch. You don't have to specify any setting for apple pencil.

In the touches began method,

you can differntiate the touches as:

   if(touch.type==UITouchTypeStylus){
               //perform stylus action
   }


来源:https://stackoverflow.com/questions/35941898/uiview-do-not-react-on-apple-pencil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!