Selector to get indexPath UICollectionView Swift 3.0

后端 未结 5 1545
北恋
北恋 2020-12-21 16:02

I\'m trying to get indexPath on the cell when it is tapped twice. I\'m passing arguments in Selector like this but it is giving error. What is the

5条回答
  •  别那么骄傲
    2020-12-21 16:41

    The correct selector in your case is doubleTapped:. That is

    let tap =  UITapGestureRecognizer(target: self, action: #selector(doubleTapped:))
    

    You can not fire arbitrary parameter when the target method is called. You can set target on subOptioncell by

    let tap =  UITapGestureRecognizer(target: subOptioncell, action: #selector(doubleTapped:))
    

    And you can set whatever arbitrary object.parameter you want in subOptioncell

提交回复
热议问题