matghazaryan / AMSlideMenu2

Sliding Menu for iOS (Left and Right menus). Multiple storyboards and XIBs support.
MIT License
1.2k stars 194 forks source link

Tableview and delete swipe #47

Closed sisto closed 10 years ago

sisto commented 10 years ago

in a view i have a iutableview but don't work swipe on left to delete row.

Any idea?

thanks

Sabino

arturdev commented 10 years ago

are you sure that you enabled editing mode for your tableView?

sisto commented 10 years ago
   [cell setUserInteractionEnabled:TRUE];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

and

arturdev commented 10 years ago

try this: In your vc :

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    self.mainSlideMenu.panGesture.enabled = NO;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    self.mainSlideMenu.panGesture.enabled = YES;
}

//...
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{

}
amidabrian51 commented 10 years ago

I can't seem to edit my UITableView with AMSlidemenu. Tried entering the code above and this did not work. What am I missing.

jhoneylopes commented 10 years ago

I'm using iOS 8, I was with the same problem. I solved that, I'm using the following code. I don't know if this affect anything else, but It's working fine for me to edit the UITableViewCell.

steps:

  1. Go to AMSlideMenuMainViewController.m
  2. Find the follow method:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
  1. Change the "if (directionIsLeft)"
    if (directionIsLeft) {
        // My CODE #### Enable edit cell
        self.panGesture.enabled = NO;
        self.panGesture.enabled = YES;
        // end
        if (self.rightMenu) {
            return NO;
         } else {
             return YES;
         }
    }
ingouackaz commented 10 years ago

Thank you so much ! @jhoneylopes :)

soner-yuksel commented 9 years ago

@jhoneylopes :)

Thanks man, I was pulling my hair out of my skull.