开发者

iOS. How Do I Continuously Pan Across a series of Views?

开发者 https://www.devze.com 2023-03-06 00:59 出处:网络
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 th

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,

Doug


I'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.

0

精彩评论

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

关注公众号