Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.56 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.56 KB

HYPanViewController

The ViewController that recreates the vvebo app UI. The Awesome way to delete tableView cell or present new viewController.

image

###Usage

You can use handler to present new view controller:

typeof(self) __weak weakSelf = self;
HYPanGestureRecognizer *pan = [[HYPanGestureRecognizer alloc] initWithTabelView:_tableView Handler:^(HYPanGestureRecognizer *panGesture, NSIndexPath *indexpath, BOOL isLeft) {
        
        if (isLeft) {
            DetailViewController *detail = [[DetailViewController alloc] init];
            [weakSelf addChildViewController:detail];
            [weakSelf.view addSubview:detail.view];
            [detail didMoveToParentViewController:weakSelf];
        }
    }];
[pan addLeftText:@"comment" rightText:@"retweet"];
[self.view addGestureRecognizer:pan];

It also can be used to delete Cell:

typeof(self) __weak weakSelf = self;
HYPanGestureRecognizer *pan = [[HYPanGestureRecognizer alloc] initWithTabelView:_tableView Handler:^(HYPanGestureRecognizer *panGesture, NSIndexPath *indexpath, BOOL isLeft) {
        
        if (!isLeft) {
            [weakSelf.dataList removeObjectAtIndex:indexpath.row];
            [panGesture.tableView deleteRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
        }
    }];
[pan addLeftText:@"comment" rightText:@"delete"];
[self.view addGestureRecognizer:pan];

This project is inspired by Udo .