TableViewCell is not clickable with one finger tap, but it is with two fingers

后端 未结 3 1698
小鲜肉
小鲜肉 2021-01-20 19:24

I created a table view and the tableViewCell is not clickable with one finger, but when I try to click the tableViewCell with two fingers the click event takes place. I don\

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-20 19:50

    You have the following line in your set up code:

    self.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(InvitePeopleVC.dismissKeyboard)))
    

    That sets up a gesture recognizer for your whole view and that would swallow any touches on the main view. If you remove that, you should get the table cell selection working correctly :)

提交回复
热议问题