问题
In my app some of UIView
s 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