Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
reza-khalafi opened this issue Dec 2, 2017 · 1 comment

Comments

@reza-khalafi
Copy link

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
Copy link
Author

reza-khalafi commented Dec 2, 2017

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant