Commit 967e318e authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne

Add Swipe Gesture Direction Right for editing tableview

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 450da4db
......@@ -400,6 +400,10 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
if (cell == nil)
cell = [VLCPlaylistTableViewCell cellWithReuseIdentifier:CellIdentifier];
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightGestureAction:)];
[swipeRight setDirection:(UISwipeGestureRecognizerDirectionRight)];
[cell addGestureRecognizer:swipeRight];
NSInteger row = indexPath.row;
cell.mediaObject = _foundMedia[row];
......@@ -471,6 +475,20 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
[UIView animateWithDuration:animationDuration animations:animationBlock completion:completionBlock];
}
- (void)swipeRightGestureAction:(UIGestureRecognizer *)recognizer
{
if ([[self.editButtonItem title] isEqualToString:NSLocalizedString(@"BUTTON_CANCEL",@"")])
[self setEditing:NO animated:YES];
else {
[self setEditing:YES animated:YES];
NSIndexPath *path = [(UITableView *)self.view indexPathForRowAtPoint:[recognizer locationInView:self.view]];
[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:path.row inSection:path.section]
animated:YES
scrollPosition:UITableViewScrollPositionNone];
}
}
#pragma mark - Collection View
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment