UIGestureRecognizer+YYAdd.h 1.1 KB

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