Skip to content

Instantly share code, notes, and snippets.

@maxkramer
Created December 5, 2011 17:09
Show Gist options
  • Save maxkramer/1434371 to your computer and use it in GitHub Desktop.
Save maxkramer/1434371 to your computer and use it in GitHub Desktop.
- (void) handlePan:(UIPanGestureRecognizer *) gesture {
if ((gesture.state == UIGestureRecognizerStateChanged) ||
(gesture.state == UIGestureRecognizerStateEnded)) {
CGPoint location = [gesture locationInView:[self.tableView superview]];
if (location.x <= (_tableView.frame.size.width / 2) + 40) {
if (location.x < _tableView.frame.size.width / 2-70 && isFilterViewShowing)
[self.tableView setFrame:CGRectMake(location.x, 0, _tableView.frame.size.width, _tableView.frame.size.height)];
else if (location.x < _tableView.frame.size.width / 2 + 40)
[self.tableView setFrame:CGRectMake(location.x, 0, _tableView.frame.size.width, _tableView.frame.size.height)];
if (location.x > 0) {
[self.navigationItem.leftBarButtonItem setAction:@selector(hideFilterMenu)];
}
else if (location.x == 0) {
[self.navigationItem.leftBarButtonItem setAction:@selector(showFilterMenu)];
}
}
isFilterViewShowing = location.x > 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment