iOS. How Do I Continuously Pan Across a series of Views?
I have a grid of thumbnails each of which is a UIView. Each thumbnail has a pan gesture attached. If a pan gesture begins on one thumbnail, su开发者_如何学JAVAbsequent thumbnails do not acknowledge the pan gesture even though my finger is indeed moving across them. How do I get all thumbnails to react to a pan gesture even if the gesture did not initiate in the thumbnail?
Thanks,
DougI'm assuming what you're trying to do is basically scrolling through a 2d array of thumbnails? If that's the case, try putting your thumbnails into a UIScrollView. This should take care of panning through pictures. Then put UITapGestureRecognizers in each individual thumbnail if you want to perform some action upon tapping a thumbnail.
Attach the pan gesture to the superview, and use hitTest:inPoint: to determine which thumbnail the gesture is moving through.
精彩评论