views:

118

answers:

1

I am trying to intercept the touches moved in a UITableView. My goal is to not pass through touches moving up or down on the far right hand side of the table view but to handle them for other purposes. I can track touches moving on the x plane but not on the y plane. I have subclassed both the tableview and the tableviewcells, but no success.

Any help would be appreciated please.

+2  A: 

Put a narrow view above your UITableView. This view would be a sibling of your UITableView, but in the front. Enable user interaction on that view, and in your code, when you get a tap on that view, determine if you want to keep it or pass it on to the UITableView and otehr views below it. If you want to pass it off, you call:

[self.nextResponder touchesBegan:touches withEvent:event];

Otherwise, go ahead and handle it as you wish. Keep in mind that the right hand side of a TableView is usually where the index goes, if you've got it configured that way.

mahboudz
Thanks. I had originally discarded this as an option because views with alphas of less than 0.1 do not get touch events. However, setting the backgroundcolor to clearColor solved this.
Run Loop
Yeah, I had a heck of a time debugging a 0 alpha view which wasn't getting touches...
mahboudz