Why should Tap for two time on cell in UITableViewCell for show MZ pop up?
reza-khalafi opened this issue · 1 comments
reza-khalafi commented
Hello
I using MZFormSheetPresentationController for showing pop up in swift.
when using this component codes in UIViewController with table view usually must work with one tap on cell for showing my fav pop up. But now I must tapping for two time.
reza-khalafi commented
Answer:
Add UIGestureRecognizerDelegate delegate to UIViewController.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let ges:UITapGestureRecognizer = UITapGestureRecognizer.init(target: self, action: #selector(handleSingleClickOnTableViewCell))
ges.delegate = self
tableView.addGestureRecognizer(ges)
}
And
@objc func handleSingleClickOnTableViewCell(gestureRecognizer:UITapGestureRecognizer) {
let p:CGPoint = gestureRecognizer.location(in: tableView)
let indexPath:IndexPath = tableView.indexPathForRow(at: p)!
let obj= dataSourceArr[indexPath.row]
//So you can set pop up code here
}