UITextField+BlocksKit.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // UITextField+BlocksKit.h
  3. // BlocksKit
  4. //
  5. // Contributed by Samuel E. Giddins.
  6. //
  7. #import <UIKit/UITextField.h>
  8. #import "BlocksKit.h"
  9. /** Block callbacks for UITextField.
  10. @warning UITextField is only available on a platform with UIKit.
  11. Created by [Samuel E. Giddins](https://github.com/segiddins) and
  12. contributed to BlocksKit.
  13. */
  14. @interface UITextField (BlocksKit)
  15. /**
  16. * The block that fires before the receiver begins editing
  17. *
  18. * The return value indicates whether the receiver should begin editing
  19. */
  20. @property (nonatomic, copy) BOOL(^bk_shouldBeginEditingBlock)(UITextField *);
  21. /**
  22. * The block that fires after the receiver begins editing
  23. */
  24. @property (nonatomic, copy) void(^bk_didBeginEditingBlock)(UITextField *);
  25. /**
  26. * The block that fires before the receiver ends editing
  27. *
  28. * The return value indicates whether the receiver should end editing
  29. */
  30. @property (nonatomic, copy) BOOL(^bk_shouldEndEditingBlock)(UITextField *);
  31. /**
  32. * The block that fires after the receiver ends editing
  33. */
  34. @property (nonatomic, copy) void(^bk_didEndEditingBlock)(UITextField *);
  35. /**
  36. * The block that fires when the receiver's text will change
  37. *
  38. * The return value indicates whether the receiver should replace the characters in the given range with the replacement string
  39. */
  40. @property (nonatomic, copy) BOOL(^bk_shouldChangeCharactersInRangeWithReplacementStringBlock)(UITextField *, NSRange, NSString *);
  41. /**
  42. * The block that fires when the receiver's clear button is pressed
  43. *
  44. * The return value indicates whether the receiver should clear its contents
  45. */
  46. @property (nonatomic, copy) BOOL(^bk_shouldClearBlock)(UITextField *);
  47. /**
  48. * The block that fires when the keyboard's return button is pressed and the receiver is the first responder
  49. *
  50. * The return value indicates whether the receiver should return
  51. */
  52. @property (nonatomic, copy) BOOL(^bk_shouldReturnBlock)(UITextField *);
  53. @end