UIGestureRecognizer+YYAdd.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // UIGestureRecognizer+YYAdd.h
  3. // YYKit <https://github.com/ibireme/YYKit>
  4. //
  5. // Created by ibireme on 13/10/13.
  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. NS_ASSUME_NONNULL_BEGIN
  13. /**
  14. Provides extensions for `UIGestureRecognizer`.
  15. */
  16. @interface UIGestureRecognizer (YYAdd)
  17. /**
  18. Initializes an allocated gesture-recognizer object with a action block.
  19. @param block An action block that to handle the gesture recognized by the
  20. receiver. nil is invalid. It is retained by the gesture.
  21. @return An initialized instance of a concrete UIGestureRecognizer subclass or
  22. nil if an error occurred in the attempt to initialize the object.
  23. */
  24. - (instancetype)initWithActionBlock:(void (^)(id sender))block;
  25. /**
  26. Adds an action block to a gesture-recognizer object. It is retained by the
  27. gesture.
  28. @param block A block invoked by the action message. nil is not a valid value.
  29. */
  30. - (void)addActionBlock:(void (^)(id sender))block;
  31. /**
  32. Remove all action blocks.
  33. */
  34. - (void)removeAllActionBlocks;
  35. @end
  36. NS_ASSUME_NONNULL_END