BTUIKTextField.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #import <UIKit/UIKit.h>
  2. @protocol BTUIKTextFieldEditDelegate;
  3. /// @class A specialized text field that provides more granular callbacks than a standard
  4. /// UITextField as the user edits text
  5. @interface BTUIKTextField : UITextField
  6. /// The specialized delegate for receiving callbacks about editing
  7. @property (nonatomic, weak) id<BTUIKTextFieldEditDelegate> editDelegate;
  8. @property (nonatomic) BOOL hideCaret;
  9. @end
  10. /// A protocol for receiving callbacks when a user edits text in a `BTUITextField`
  11. @protocol BTUIKTextFieldEditDelegate <NSObject>
  12. @optional
  13. /// The editDelegate receives this message when the user deletes a character, but before the deletion
  14. /// is applied to the `text`
  15. ///
  16. /// @param textField The text field
  17. - (void)textFieldWillDeleteBackward:(BTUIKTextField *)textField;
  18. /// The editDelegate receives this message after the user deletes a character
  19. ///
  20. /// @param textField The text field
  21. /// @param originalText The `text` of the text field before applying the deletion
  22. - (void)textFieldDidDeleteBackward:(BTUIKTextField *)textField
  23. originalText:(NSString *)originalText;
  24. /// The editDelegate receives this message when the user enters text, but
  25. /// before the text is inserted
  26. ///
  27. /// @param textField The text field
  28. /// @param text The text that will be inserted
  29. - (void)textField:(BTUIKTextField *)textField willInsertText:(NSString *)text;
  30. /// The editDelegate receives this message after the user enters text
  31. ///
  32. /// @param textField The text field
  33. /// @param text The text that was inserted
  34. - (void)textField:(BTUIKTextField *)textField didInsertText:(NSString *)text;
  35. @end