Closed auto234875 closed 10 years ago
One solution I've used is
Then in the completion block for the swipe, [self.tableView setAllowsSelection:YES];
This reenable cell selection at the very last second, too late for the user to select anything and cause a crash.
But still, there is the case where the user cancel the swipe by slowly swiping back into original position.
At this point, cell selection is disabled and there is no good place to re-enabled it.
Using this will only cancel out the first solution.
Perhap I can re-enable cell selection in this delegate method with a slight delay.
Pretty crude solution,
Hi @auto234875, I cant' reproduce the issue. Are you trying on a personal project or with the demo project? Also which version of the library are you using? Thanks
I'm using the latest version of the main branch in a private project.
I have switch mode state 3 triggering a segue in the completion block. The cell tapped selection leads to a different segue.
The segue in the switch mode state 3 completion block takes ~0.5 seconds to finish.
In that small amount of time, if you tap on that cell or another cell, it will trigger the tap selection segue instead of the segue inside the completion block.
Once the transition finish, if you try to navigate to another viewcontroller, the entire app will crash.
You can still exit to the home screen at this point, but if you go back into the app again, the entire iphone will freeze and you have to do a hard reset.
The iPhone freeze / hard reset is a really weird behavior and I don't think it's related to the library itself but a bug in iOS.
What you can do to avoid that is disabling interaction on the tableView during the swipe:
- (void)swipeTableViewCellDidStartSwiping:(MCSwipeTableViewCell *)cell {
self.tableView.userInteractionEnabled = NO;
}
and then re-enable interaction when the completion block is executing:
[cell setSwipeGestureWithView:checkView color:greenColor mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState1 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
self.tableView.userInteractionEnabled = YES;
// Push your view controller
// [...]
}];
To replicate this, swipe and very quickly tap on the same cell or another cell.
This will result in a crash because selection and swiping leads to different segue. Does anyone have any idea how to fix this?