Skip to content

Commit

Permalink
Fixed bug with UIButtons now reacting properly sometimes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gordontucker committed Apr 9, 2019
1 parent 50da440 commit 8a2132a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions FittedSheetsPod/SheetViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,12 @@ public class SheetViewController: UIViewController {
}

extension SheetViewController: UIGestureRecognizerDelegate {
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
guard let view = touch.view else { return true }
// Allowing gesture recognition on a button seems to prevent it's events from firing properly sometimes
return !(view is UIButton)
}

public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
guard let panGestureRecognizer = gestureRecognizer as? InitialTouchPanGestureRecognizer, let childScrollView = self.childScrollView, let point = panGestureRecognizer.initialTouchLocation else { return true }

Expand Down

0 comments on commit 8a2132a

Please sign in to comment.