In AcaniUsers, I’ve created a grid of ThumbView : UIView instances inside of a UITableView. All thumbViews have a width of kThumbSize. How do I detect if touches ended inside the same view in which they began?
In AcaniUsers , I’ve created a grid of ThumbView : UIView instances inside of
Share
The following works, but I’m not sure if it’s the best way to go about it. I think so though.
Since all
thumbViewshave a width ofkThumbSize, just check intouchesEndedthat the x-coordinate of thelocationInViewof theUITouchinstance (assumingself.multipleTouchEnabled = NO) is less than or equal tokThumbSize. This means the touches ended inside thethumbView. No need to check the y-coordinate because if the touches move vertically, thetableView, which contains thethumbViews, scrolls and the touches are cancelled.Do the following in
ThumbView : UIView(whose instances are subviews of aUITableView):To only register touches on one
thumbViewat a time, you also probably want to setself.exclusiveTouch = YES;in theinitinstance method ofThumbView.