PaperFold-for-iOS icon indicating copy to clipboard operation
PaperFold-for-iOS copied to clipboard

UITableView Editing Issue (swipe to delete)

Open malcommac opened this issue 12 years ago • 4 comments

Hi, I'm using PaperFold with a central UIView (an UIView with an UITableView inside) and a right UIView (an UIView with a Map). Everything is fine but there is an issue when I try to use swipe-to-delete inside a cell of the table. I suppose the event is handled by the PaperFoldView class and the event itself is never fired:

  • (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;

and consequently:

  • (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;

malcommac avatar Nov 09 '12 00:11 malcommac

Hi,

I don't think swipe-to-delete & paperfold can go well together. It's different to figure out user's intent, whether they want to delete or drag paperfold. When I use it myself, I just have to add an edit button. Unless you have a better solution?

Sent from my iPad

On 9 Nov, 2012, at 8:28 AM, Daniele Margutti [email protected] wrote:

Hi, I'm using PaperFold with a central UIView (an UIView with an UITableView inside) and a right UIView (an UIView with a Map). Everything is fine but there is an issue when I try to use swipe-to-delete inside a cell of the table. I suppose the event is handled by the PaperFoldView class and the event itself is never fired:

(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; and consequently:

(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath; — Reply to this email directly or view it on GitHub.

honcheng avatar Nov 09 '12 03:11 honcheng

The "problem" happends with the Pan gesture of PaperFoldView (init method):

panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onContentViewPanned:)]; [_contentView addGestureRecognizer:panGestureRecognizer];

I've tried to pass the event to it's subviews but the result is not good. So I've added an util method to disable/enable pan gesture (when I need to edit the table I'm lucky because there is not any right/left fold view you can open).

Something like that:

  • (void) disablePanning:(BOOL) disable { if (disable) [_contentView removeGestureRecognizer:panGestureRecognizer]; else [_contentView addGestureRecognizer:panGestureRecognizer]; }

It's a bit dirty but at this time I've not found a better solution.

malcommac avatar Nov 09 '12 09:11 malcommac

when you need to edit the table, you can just disable panning for left and right folds. There are methods for that. Swipe still doesn't work when you disable them?

honcheng avatar Nov 09 '12 10:11 honcheng

Are u talking about enableLeftFoldDragging,enableRightFoldDragging? I've tried to set both as NO but it does not work (pan gesture still active)

malcommac avatar Nov 09 '12 13:11 malcommac