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

会有一股神秘感。 提交于 2019-12-05 03:50:18

问题


I am working on a drawing app, with pen touch, on iphone and ipad. Till now , I have implemented the basic drawing and tested with digital pen and it work fine, but I have one issue, while drawing on iphone/ipad, if my fingers touch the screen before I draw with pen , the pen wont work, So what I want to achieve is that, I want to able to write with pen, even if my fingers are touching the ipad screen.

Regards Ranjit


回答1:


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.




回答2:


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!




回答3:


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.



来源:https://stackoverflow.com/questions/11081383/writing-with-digital-pen-on-ipad-iphone-by-keeping-hand-on-screen

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