Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-21-2009, 02:13 AM   #10 (permalink)
rnieves
Registered Member
 
Join Date: Feb 2009
Posts: 50
Default

That sounds great but I want to be able to send the event and the touch to the singleTap method since this will forward it if necessary to another responder. I cannot do this with this solution.


I have tried using a timer but there seems to be a problem. Can anybody tell me what might be wrong.

In my touchesBegan method I did
Code:
	if ([doubleTapTimer isValid]) {
		[doubleTapTimer invalidate];
		doubleTapTimer = nil;
	}
	if(![doubleTapTimer isValid]) {
		[self startTouchTimer:DOUBLE_TAP_TIMER withTouch:touches andEvent:event];
	} else if (tapCount == 2) {
		if(self.zoomedView) {
			[self resetScrollZoom];
		} else {
			[super touchesBegan:touches withEvent:event];
		}
		[doubleTapTimer invalidate];
		doubleTapTimer = nil;
		return;
	}
Then in my startTouchTimer method I prepare my timer with an invocation to call the singleTapMethod.

Code:
//Prepare invocation
	SEL singleTapSelector = @selector(singleTapDone:withEvent:);  //selector
	NSMethodSignature * sig = [[self class] instanceMethodSignatureForSelector:singleTapSelector]; //signature to initialize
	NSInvocation *singleTapObjects = [NSInvocation invocationWithMethodSignature:sig]; //initialize selector
	[singleTapObjects setTarget:self];
	[singleTapObjects setSelector:singleTapSelector];
	[singleTapObjects setArgument:&touches atIndex:2];		//set parameters for invocations
	[singleTapObjects setArgument:&event atIndex:3];
	
	
	doubleTapTimer = [NSTimer scheduledTimerWithTimeInterval:delay invocation:singleTapObjects repeats:NO];
This successfully calls the singleTapMethod and when looking at the debugger the objects passed are the same (location wise) but when calling [super touchesBegan:withEvent] on this method it does not handle it at all. Nothing happens. If I just implement the [super touchesBegan:withEvent] on the touchesBegan method it successfully handles it by forwarding it.

BTW already tried using self.nextResponder to try and force it myself to forward the touchesBegan but it won't work either.


Edit:

I did some more research and although the touch and event do get forwarded, when getting to the touchesBegan on the subview they have been forwarded to the reason they don't work is because getting the coordinates and/or the tapCount returns cero for the touch. Can anybody please shed some light on this situations?

Last edited by rnieves; 06-21-2009 at 03:22 AM.
rnieves is offline   Reply With Quote
 

» Advertisements
» Online Users: 285
19 members and 266 guests
ADY, apatsufas, BdR, Diegan, Duncan C, F_Bryant, glenn_sayers, Guthook, ilmman, joeallenpro, ketaskin, michelle, Music Man, NSeven, Sunny46, VikMyr, vogueestylee, zbynda, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,708
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:07 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.