Writing with digital pen on ipad/iphone by keeping hand on screen

∥☆過路亽.° 提交于 2019-12-03 21:10:19

There is no way to differentiate between a finger and a stylus, as a stylus is supposed to emulate a touch from a finger. You will either have to make it so that all touches draw (including a hand on the screen) or make it so only the first "finger" that touches the screen can draw (meaning that you must put the stylus on the screen before your hands can touch it).

@iLive is correct in mentioning those delegate methods that you should implement, but I assume that you are already using these methods.

UPDATE:

Tracking specific touches is as simple as adding the addresses of their instances to a array during touchesBegan. Append them to a CFMutableArrayRef. Then, in the touchesMoved method, you can simply get the index of the touch in order.

The most likely answer is in the number of touches you can receive.
Evidently, if do not enable multi-touch you will be stuck in receiving one touch at a time!
Thus, if your hand touched the screen first, then the other touches made by the digital pen will not be received.

First start by enabling the multi-touch capability.
These are the methods you will have to implement:

  • -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
  • -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
  • -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
  • -(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event

Look into Apple's link: http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MultitouchEvents/MultitouchEvents.html for more information!

Hope this helped!

Addition You could make at least a layer (accepting no touches) coming up from the lower edge (configurable in height by the user) so that at least your palm can rest on the ipad screen surface which lowers the possibility of unwanted touches and makes drawing more stable.

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