MGSwipeTableCell
MGSwipeTableCell copied to clipboard
Delete Tableview Cell when swipe is more that half of screen width
Hi,
I am not able to find way of "How to enable delete of row only if user swipe cell more than half of screen width".
I am using this library in one of my project.
Hi @Sunitadaffodil
You can do this way. Implement the swipeTableCellWillBeginSwiping delegate method and calculate the expansion threshold based on the buttons width and the UITableView width
-(void) swipeTableCellWillBeginSwiping:(MGSwipeTableCell *) cell
{
NSArray<MGSwipeButton*> * buttons = cell.rightButtons;
CGFloat width = 0;
for (MGSwipeButton * btn in buttons) {
width += btn.bounds.size.width;
}
cell.rightExpansion.threshold = (_tableView.bounds.size.width * 0.5)/width;
}