andreamazz / AMScrollingNavbar

Scrollable UINavigationBar that follows the scrolling of a UIScrollView
MIT License
6.05k stars 633 forks source link

When swipe back from edge of the screen, the scroll should disable #143

Closed iCell closed 9 years ago

iCell commented 9 years ago
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if ([gestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizer class]]) {
        return NO;
    }
    return YES;
}
andreamazz commented 9 years ago

Good point, thanks!

NicholasTD07 commented 9 years ago

@andreamazz Is it possible to disable vertical scrolling when user is swiping on a UITableViewCell?

iCell commented 9 years ago

@NicholasTD07 After swiping on a UITableViewCell:

[self.tableView setScrollEnabled:NO];

And then, after several actions, set it back.

NicholasTD07 commented 9 years ago

@iCell Could you explain it in detail? For example, where should I call this?

iCell commented 9 years ago

@NicholasTD07 I think I‘ve already explained clearly in my comment.

NicholasTD07 commented 9 years ago

@iCell I am not saying that I want to disable vertical scrolling at any time, but only when the user is swiping a table view cell to see the action items, like the "Archive" option in "Mail" app which is shown when user swipe horizontally on a UITableViewCell.

iCell commented 9 years ago

@NicholasTD07 I said after swiping a cell you can use the code to disable the scrolling.

NicholasTD07 commented 9 years ago

@iCell I want to disable the vertical scrolling when the user is swiping, which starts from when user starts to swipe and ends at when the user stops....

iCell commented 9 years ago

@NicholasTD07 All right, you can detect the state of swipeGesture(or panGesture) in that cell, when the user starts to swipe, the state of the gesture should be UIGestureRecognizerStateBegan, and UIGestureRecognizerStateEnded when the swiping is ended. You can add a panGesture to the cell or maybe there's some ways to get the swiping gesture on the cell.

NicholasTD07 commented 9 years ago

@iCell I would like to see whether there is a solution that uses UITableViewCell itself without any modification. :)

iCell commented 9 years ago

@NicholasTD07 I suggest you to subclass a UITableViewCell to implement what you want.