mutualmobile / MMDrawerController

A lightweight, easy to use, Side Drawer Navigation Controller
MIT License
6.76k stars 1.38k forks source link

best way to delete table row under MMDrawerController #407

Open davidnomo opened 8 years ago

davidnomo commented 8 years ago

Hi there,

I need to delete tablerow under MMDrawerController on ios swift. But swiper/gesture control goes to MMDrawerController. what is the best way to delete table row under the controller? Tried too disable MMDrawerController for given viewcontroller but it was not much fun. is there any one implement this functionality under MMDrawerController pls share. Thanks

ilidar commented 8 years ago

@davidnomo Something like that could work for you:

__typeof(self) __weak weakSelf = self;
[self.drawerController setGestureShouldRecognizeTouchBlock:
    ^BOOL(MMDrawerController *drawerController, UIGestureRecognizer *gesture, UITouch *touch) {
      CGPoint location = [touch locationInView:weakSelf.window];
      CGFloat width = CGRectGetWidth([UIScreen mainScreen].bounds);
      return 3.0f * location.x <= 2.0f * width;
    }];
mugx commented 7 years ago

I solved the problem, for me the solution was the following: In the file MMDrawerController.m at the beginning of -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{

I added this code:

NSString *className = NSStringFromClass([touch.view class]);
if ([className isEqualToString:@"UITableViewCellContentView"]) {
    return NO;
}