简体   繁体   中英

Unable to select cell in UICollectionView with a single tap

I'm unable to select a cell in my custom UICollectionViews with a single tap. Previously I've only worked with UITableViews and had no problem with selection of cells.

Here is my layout:

布局

and hierarchy:

等级制度

I've inserted collection view in table view to have horizontal scroll of several rows of elements.

Cell gets selected only after long press. Short taps have no effect. I've disabled Delays content touches on collection view but that have not helped.

Also I am looking for a way to implement single selection across multiple collection views, because each table view cell holds a collection view.

Solved

UIGestureRecognizer that was used to hide keyboard was causing the problems. It was needed to set: tapRecognizer.cancelsTouchesInView = false .

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