开发者

How to make UITableView(Controller) catch multitouch events?

I have a subclass of UITableViewController that works as expected. I'd like to capture multitouch events for the whole 开发者_如何学Ctable to do something with them.

The way I understand it, I should make the tableView of the controller be a subclass of UITableView. In that class I could capture the touchesMoved etc events.

But I also understand that UITableView is a subclass of UIScrollView which hijacks all the touch events so that I never see them.

So, is there some way to still get to those multitouch events for my table? Specifically I'd like to implement something like two-finger pinch/zoom and one-finger horizontal dragging.

Since those touch events are all passed to table cells, perhaps I should do this at table cell level? The only question there is, is this compatible with multitouch? (So that I can aggregate events from different cells as multitouch events and process those...)

EDIT: tried with cells and was able to see some horizontal events. All the vertical events, though, are completely hijacked by the UIScrollView as table scrolls. I wouldn't want to hack this if there's any way at all to make the UIScrollView un-hijack these events...


This solution seems to work fine and feels quite clean. I'll leave the question open for a while, for if someone wants to suggest something else, and then mark this as answer at some point if I won't get anything more.

EDIT: this answer is obsolete, since the modern way to do this, of course, is UIGestureRecognizers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜