I'm using a paper fold animation To show some content from the top of the screen, over the tableView.
Right now i have a button that triggers this folding action.
I would like instead to trigger this action by swiping from top to bottom. but my TableView is full screen, so i figured if there is a way to make on UITableViewCell, or a part of the table, not scrollable, for it to trigger the Fold swipe instead.
I tried using the UISwipeGestureRecognizer But it doesn't work so well...
There are several ways to stop UITableView from scrolling. UITableView is a subclass of UIScroll view so you can use the UIScroll view methods to stop the table view being scrollable. So in your tableViewController you can call [[self tableView] setScrollEnabled:NO]
. You should also be able to stop any user interaction on the table view by calling [[self tableView] setUserInteractionEnabled:NO]
(a method on UIView).
You could subclass the UITableView and override the setContentOffset:
method (another scrollView method), and only call [super setContentOffset:]
when you actually want the table view to scroll (it's possible that you may need to override other methods as well.
You can also get hold of the pan gesture recogniser that the scrollView is using, this allows you to see exactly what messages the scrollView is getting for scrolling and you may be able to adjust the scroll offset accordingly [[self tableView] panGestureRecognizer]
. Once you have the panGestureRecognizer you should be able to set it to wait for your swipeGestureRecognizer to fail using [UIPanGestureRecognizer requireGestureRecognizerToFail:
. Which will mean that the pan gesture recogniser the scroll view uses will only start working if the swipe fails, you may need to make it so the swipeGestureRecognizer fails if it doesn't start near the edge of the screen.