nverinaud / NVSlideMenuController

A slide menu done right for iOS.
MIT License
175 stars 33 forks source link

Pan gesture recognizer interferes with UITableViewCell reorder control #2

Closed leonbreedt closed 11 years ago

leonbreedt commented 11 years ago

Hi!

The pan gesture recognizer prevents the UITableViewCell reorder control from functioning correctly when the tableview is in editing mode, and the UITableView is contained within a controller that is a content controller.

I have successfully worked around this by adding NVSlideMenuController as a UIGestureRecognizerDelegate of the pan gesture recognizer, and in -gestureRecognizerShouldBegin:, returning NO if the content view controller is in editing mode, but this is not 100% reliable. E.g. if the content view controller is a navigation controller that wraps the actual content controller.

Another way could be to only respect horizontal pans, and somehow have the original gesture recognizer on the reorder control process vertical ones, but I did not investigate this option fully.

Leon

nverinaud commented 11 years ago

Did you try setting panEnabledWhenSlideMenuIsHidden to YES when you enter in editing mode ?

Hum... I'll override the setter to change the enabled property of the pan gesture if the menu is hidden.

leonbreedt commented 11 years ago

Hi Nicolas,

Thanks for the quick response! Not sure I understand 100% how that would address the issue, but please correct me if I'm misunderstanding :)

I'll try to explain a bit more.

I have NVSlideMenuController wrapping a menu view controller, and a content view controller. The content view controller is a UINavigationController that contains a top view controller with a UITableView filling its bounds.

This works great, and when I pan from left to right, the content controller slides over and reveals the menu, as expected.

The UITableViewCell in the content controller have showsReorderControl set to YES. As you probably know, when the table view is in edit mode, it puts a control on the right hand side of the cell so you can tap & then drag vertically to reorder the cells.

When the table view is in edit mode, with NVSlideMenuController pan gesture enabled, I can't drag cells more than one row, and for some reason the drag is automatically stopped after one row of movement vertically.

I don't think that the menu visible or hidden affects this, when I have this problem I don't have the menu visible at all, which is why I'm not sure whether your suggestion will fix this.

Does that clarify things?

I can take some screenshots to show what I mean if that would help :)

Awesome library by the way, I've tried most of them, and discovered yours through NSScreencast.

Thanks! Leon

nverinaud commented 11 years ago

I see exactly what you mean. The panEnabledWhenSlideMenuIsHidden property in fact disable the pan gesture when the menu is hidden. What I need to do is override - setPanEnabledWhenSlideMenuIsHidden: in order to disable the pan gesture if I detect that the menu is hidden. I'll do it tomorrow ;-)

And thanks for compliments ;-)

nverinaud commented 11 years ago

I invite you to use the new panGestureEnabled property. :)

leonbreedt commented 11 years ago

Awesome, thanks! Removed my local hack :)