tableview添加上下滑动手势

来源:互联网 发布:python 真假 编辑:程序博客网 时间:2024/05/18 03:01
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)];    [swipe setDirection:UISwipeGestureRecognizerDirectionDown];    swipe.delegate = self;    [self.mtable addGestureRecognizer:swipe];            UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)];    [swipeUp setDirection:UISwipeGestureRecognizerDirectionUp];    swipeUp.delegate = self;    [self.mtable addGestureRecognizer:swipeUp];
-(void)swipe:(UISwipeGestureRecognizer*)swipe{        if (swipe.direction == UISwipeGestureRecognizerDirectionUp) {        [UIView animateWithDuration:0.5 animations:^{            //[self.cacView removeFromSuperview];        }];    }    else    {        [UIView animateWithDuration:0.5 animations:^{            // [self.cacView removeFromSuperview];        }];    }}


0 0