In my iPhone app I'm overriding the touchesBegan:withEvent
method in my view and what I want to do is make some tweaks to the UITouch object found in the NSSet and send it to another view. I couldn't find anywhere how to create a UITouch object.
Asked
Active
Viewed 5,822 times
3

JJJ
- 32,902
- 20
- 89
- 102

ForeignerBR
- 2,449
- 4
- 23
- 28
1 Answers
3
The way I got it to work was by categorizing the UITouch and create an init method. This blog should explain how to do it:
http://cocoawithlove.com/2008/10/synthesizing-touch-event-on-iphone.html

ForeignerBR
- 2,449
- 4
- 23
- 28
-
1Warning: this is not a very app store friendly approach. Your app may well get rejected if it contains this category! – occulus Feb 28 '11 at 16:14
-
1Sadly, this doesn't work for iOS 7 anymore. It won't eighter complile! Is there a work arround for this? I'd really like to integrate that fancy stuff. – NicTesla Feb 07 '14 at 07:51
-
"Me,too" with NicTesla -- got the whole `SelfTesting` project from CocoaWithLove, but it's got dozens of compile errors just out of the box. Looks like we don't have access to UITouch's iVars, anymore (so, for example, in `initInView:`, the line `_tapCount = 1;` is an error: use of undeclared identifier. There are many-many more of these. – Olie Jul 31 '14 at 20:07
-
NOTE: after much Google/SO/etc., learning, I found a way to set the `_tapCount` and other variables using `getIvarPointer` and KVO. None of it's very pretty, but it works. – Olie Aug 04 '14 at 17:41
-
Hi Olie, can you share with us how you achieved this? we are also trying to achieve something similar and was thinking of utilizing http://stackoverflow.com/questions/4028734/how-to-programmatically-fake-a-touch-event-to-a-uibutton to create UItouch object – Sreejith Bhatt Aug 06 '14 at 14:38
-
@Olie, can you post your solution please? – Luda Jul 03 '16 at 12:19
-
I can't post my solution-code, for contractual reasons (it was work-for-hire; not my IP.) However, the blog linked gives the solution; I only had to make minor changes (defining some variables, if I recall.) I'm sorry -- I know SO is meant to be the place to copy/paste answers, but I can't. :\ – Olie Jul 03 '16 at 16:57