Custom touch tracking in iphone

我是研究僧i 提交于 2019-12-25 03:39:07

问题


I don't want to use any of the normal touch events in the iphone sdk.

When an user touches the screen I want to find where he touched and all of pixels he touches. Is there a way to do it in iphone ? may be using a low level SDK.

i want this to do it for some thing like a drawing app with finger on iphone.


回答1:


There is no low-level API. IIRC, the data in a touch object is actually returned by the hardware. In other words, that is all the data that software can get.

Having done some touch UI experiments in the distant past, I can tell you that processing real world touches in software is a lot more complicated than you would expect on first glance. It's not like tracking a mouse. A finger is actually a very blunt and imprecise pointing instrument on the scale of a mobil screen. There is a great deal of variation in finger size, pressure of contact, contact area, angle of contact and consistency of contact. It takes a lot of processing to turn that blunt imprecision into a single point or collection of points that an API can easily use.

I wouldn't try to reinvent the wheel even if you find a way to extract more data from the hardware. If nothing else, (puts on interface-nazi hat) if your touch interface behaves different from other apps, users will be confused when the have to switch back and forth.




回答2:


A touch is a rather imprecise gesture, so getting all the pixels that one encompasses is not really possible. However, you can get the rough 'center' of a touch, and extrapolate an area around that for a group of 'touched pixels'. No need to use a low level SDK, just override -touchesBegan:withEvent: on UIView.



来源:https://stackoverflow.com/questions/1985468/custom-touch-tracking-in-iphone

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