MZFormSheetPresentationController icon indicating copy to clipboard operation
MZFormSheetPresentationController copied to clipboard

Why should Tap for two time on cell in UITableViewCell for show MZ pop up?

Open reza-khalafi opened this issue 8 years ago • 1 comments

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 avatar Dec 02 '17 08:12 reza-khalafi

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
}

reza-khalafi avatar Dec 02 '17 08:12 reza-khalafi