YYGestureRecognizer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // YYGestureRecognizer.h
  3. // YYKit <https://github.com/ibireme/YYKit>
  4. //
  5. // Created by ibireme on 14/10/26.
  6. // Copyright (c) 2015 ibireme.
  7. //
  8. // This source code is licensed under the MIT-style license found in the
  9. // LICENSE file in the root directory of this source tree.
  10. //
  11. #import <UIKit/UIKit.h>
  12. /// State of the gesture
  13. typedef NS_ENUM(NSUInteger, YYGestureRecognizerState) {
  14. YYGestureRecognizerStateBegan, ///< gesture start
  15. YYGestureRecognizerStateMoved, ///< gesture moved
  16. YYGestureRecognizerStateEnded, ///< gesture end
  17. YYGestureRecognizerStateCancelled, ///< gesture cancel
  18. };
  19. /**
  20. A simple UIGestureRecognizer subclass for receive touch events.
  21. */
  22. @interface YYGestureRecognizer : UIGestureRecognizer
  23. @property (nonatomic, readonly) CGPoint startPoint; ///< start point
  24. @property (nonatomic, readonly) CGPoint lastPoint; ///< last move point.
  25. @property (nonatomic, readonly) CGPoint currentPoint; ///< current move point.
  26. /// The action block invoked by every gesture event.
  27. @property (nonatomic, copy) void (^action)(YYGestureRecognizer *gesture, YYGestureRecognizerState state);
  28. /// Cancel the gesture for current touch.
  29. - (void)cancel;
  30. @end