简体   繁体   中英

Gesture recognizer for tap event at specific positions on the screen

I am displaying hundreds of thumbnails in my view . I know default way to handle tap on thumbnail is using UICollectionView delegate method "didSelectItemAtIndexPath" but since its many thumbnails i wanted to look into adding gestures to the screen position so when i tap on a particular spot on the screen, it will handle the event accordingly for that particular thumbnail underneath. I would like to know if it is a good/possible approach?

It would be a hell of a lot easier to use a UICollectionView.

If you need a custom layout then you can subclass UICollectionViewLayout and get some really cool dynamic layouts.

You also get the added bonus of dequeued cells meaning that you get better memory management using it.

You may find UIGestureRecognizer useful. A good tutorial to get you started is here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM