iphone touch shape or raw data

可紊 提交于 2020-07-05 15:57:20

问题


Anyone know if it is yet possible to detect the touch shape? Maybe through getting the raw touchscreen data?

I found this question/answer here: How to get raw touchscreen data?

That mentions GSEvent, but it is quite old.

I'd like to try to get a rough calculation of the pressure of the touch by its shape/area, but of course UITouch only gives a calculated point.


回答1:


Yes, raw touch data is contained in the GSEventRecord object, particularly what you are looking for is the pathMajorRadius property on GSPathInfo, which gives the major radious on the tap. This is a rough estimate of the pressure, but take into account big/small fingers give also different measures.

Watch out for the pathPressure property also in GSPathInfo, it does NOT contain the pressure. It always contains 1, capacitive screens (like the iPad's or IPhone's) do not measure pressure at all.

If you are planning submitting your app in the app store, you won't be able to do it if you include access to private frameworks (like in this case, GSEvent.h in the GraphicServices framework). But what you need to do is catch every UIEvent in the sendEvent method of your subclassed UIApplication, then use the methods in https://github.com/kennytm/iphone-private-frameworks/blob/master/GraphicsServices/GSEvent.h to get the information of the GSEvent.



来源:https://stackoverflow.com/questions/4342399/iphone-touch-shape-or-raw-data

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