BTUIKCardNumberFormField.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #import "BTUIKFormField.h"
  2. #import "BTUIKCardType.h"
  3. @protocol BTUIKCardNumberFormFieldDelegate;
  4. /// @class Form field to collect a card number.
  5. @interface BTUIKCardNumberFormField : BTUIKFormField
  6. /// BTUIKCardNumberFormFieldState modifies the form field
  7. /// Default: Allows the input of a number upto 16 digits and does Luhn checks for validity while editing.
  8. /// Validate: Displays a `Next` button accessory view rather than validating while edting. Set the cardNumberDelegate to receive button press. Card numbers of any length can be entered.
  9. /// Loading: Displays a loading indicator accessory view
  10. typedef NS_ENUM(NSInteger, BTUIKCardNumberFormFieldState) {
  11. BTUIKCardNumberFormFieldStateDefault = 0,
  12. BTUIKCardNumberFormFieldStateValidate,
  13. BTUIKCardNumberFormFieldStateLoading,
  14. };
  15. /// The card type associated with the number currently being entered
  16. @property (nonatomic, strong, readonly) BTUIKCardType *cardType;
  17. /// The card number
  18. @property (nonatomic, strong) NSString *number;
  19. /// The state of the form
  20. @property (nonatomic) BTUIKCardNumberFormFieldState state;
  21. /// The delegate, primary used for validateButtonPressed calls
  22. /// Not necessary unless using BTUIKCardNumberFormFieldStateValidate
  23. @property (nonatomic, weak) id <BTUIKCardNumberFormFieldDelegate> cardNumberDelegate;
  24. /// Whether to show the card hint accessory
  25. - (void)showCardHintAccessory;
  26. @end
  27. /// @protocol This protocol is required by the delegate to receive the validateButtonPressed calls when using BTUIKCardNumberFormFieldStateValidate
  28. @protocol BTUIKCardNumberFormFieldDelegate <NSObject>
  29. - (void)validateButtonPressed:(BTUIKFormField *)formField;
  30. @end