Swift UITableView didSelectRowAtIndexPath not getting called

前端 未结 10 2028
野的像风
野的像风 2021-02-06 23:18

New to IOS development and am having trouble with handling cell selection on a table. Whenever I select, the method is not getting called below - any idea why?

My proje

10条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-06 23:52

    Another caveat is tap gesture recognizers. It's a common use case to use tap gesture recognize to handle different logic within your view controllers with table views, whether that's exiting touch control or first responders.

      let tapGesture = UITapGestureRecognizer(target: self, action: #selector(viewTapped))
      view.addGestureRecognizer(tapGesture)
    

    E.G. This line of code handles dismissing a date picker in my application and prevents my tableview from calling didSelectRow delegate method

提交回复
热议问题