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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-08-2009, 08:31 PM   #1 (permalink)
New Member
 
Join Date: Jan 2009
Posts: 2
Unhappy Concurrent calls of touchesEnded

Like many others, I am trying to intercept touches within a table view. In short, I seem to be getting the event calls twice; worse, the calls are concurrent.

UITableView is subclassed, and has (among others) a method touchesEnded with code (abbreviated)

- (void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event {
z1105++; // To count concurrency.
NSLog(@"Log 1854 touchesEnded x%x(%d):", self, z1105);
[super touchesEnded: touches withEvent: event];
NSLog(@"Log 1102 touchesEnded: after super call.");
[(AlphaTableViewController *)self.delegate touchesEnded: touches withEvent: event];
z1105--;
}

The call to super seems necessary, because without it table-cell selection doesn't work. But with it, I receive touchesEnded -twice- for the same touch, as shown by this log output:

2009-03-09 11:24:32.967 myApp [13028:20b] Log 1854 touchesEnded x52b6e0(1):
2009-03-09 11:24:32.969 myApp [13028:20b] Log 1854 touchesEnded x52b6e0(2):
2009-03-09 11:24:32.971 myApp [13028:20b] Log 1102 touchesEnded: after super call.
2009-03-09 11:24:32.971 myApp [13028:20b] Log 1102 touchesEnded: after super call.

Does anyone know why this is happening, and how to avoid it?

Thanks!

[PS -- I am aware in general terms of the fact that UIScrollView messes with hitTest, and related topics.]

Last edited by Nunibad; 03-08-2009 at 08:33 PM.
Nunibad is offline   Reply With Quote
Old 04-04-2009, 01:19 PM   #2 (permalink)
Registered Member
 
brendand's Avatar
 
Join Date: Aug 2008
Posts: 223
Default

Did you have any resolution to this? I seem to be having similar problems.
brendand is offline   Reply With Quote
Old 04-06-2009, 03:11 PM   #3 (permalink)
New Member
 
Join Date: Jan 2009
Posts: 2
Default

Quote:
Originally Posted by brendand View Post
Did you have any resolution to this? I seem to be having similar problems.
Not yet, Brendan. But I think I have a better idea of what might be going on. I believe the table view is over-riding hittest in order to capture the touch events before the table cell that would normally do so, in order to check whether the gesture is a vertical swipe that should cause a scroll. Once that's done, the event is sent to the table cell "as normal", whence vie the responder chain it eventually reaches the tableview a second time. You can tell them apart because the second touchesBegan comes with a touchUp phase.

Still, until I figure this out completely (or someone else does!) I have tried out other ways of building the interface functionality I'm after.

Also I get inexplicable behaviour when I try to capture double-clocks with delayed method calls: it goes into a loop passing the same event again and again. If however I override the touchesBegan etc in TableCell, with no super call (ie to consume them and prevent their second appearance) things are better --- except the delayed call loses its location information, and you can't figure out which cell it was that was double-tapped.

All very mysterious. Sorry I don't know more at this stage!

Carroll

PS: Please excuse typos etc --- I am not at my usual site.
Nunibad is offline   Reply With Quote
Reply

Bookmarks

Tags
events, table view, touchesended, uitableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 320
23 members and 297 guests
@sandris, ADY, BrianSlick, dacapo, Dani77, Dattee, dre, HDshot, HemiMG, JasonR, MarkC, mer10, nibeck, prchn4christ, Rudy, ryandb2, spiderguy84, themathminister, timle8n1, tomtom100, viniciusdamone, vogueestylee, vvenkatachallam
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,883
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, vvenkatachallam
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:12 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0