iDevelopper / PBRevealViewController

A UIViewController subclass for revealing a left and/or right view controller above or below a main view controller.
MIT License
80 stars 16 forks source link

Swipe to delete UITableView #77

Closed justdan0227 closed 3 years ago

justdan0227 commented 4 years ago

Trying to get swipe to delete a row on table view. Do I need to disable pan left while on this view?

iDevelopper commented 4 years ago

Where is this table view (On left, main or right view controller)?

Is it a table view controller? Or a table view in a view controller?

Do you have a right view controller?

justdan0227 commented 4 years ago

So sorry did not see this reply.. so my table view is in the main view and I want to allow swipe to delete without affecting the left view controller (right is not used)

iDevelopper commented 4 years ago

You can use:

    override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]?

Or:

    override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool

and

    override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath)
marcotuliofr commented 4 years ago

I had the same issue. The delegate swipe methods of table view aren't been called. I tried with UITableViewController, and UITableView within UIViewController. What resolve to me: In the view that i need the tableView delegate work. (inside viewdidAppear) self.revealViewController()?.panGestureRecognizer?.isEnabled = false

The others view that use RevealController (in my case the mainView is a TabBar, in the viewDidAppear method too) self.revealViewController()?.panGestureRecognizer?.isEnabled = true

Hope it help u.