All Products
Search
Document Center

Input dialog

Last Updated: May 25, 2021

AUInputDialog specifies the style of a pop-up window with an input box. The Window level of the pop-up window follows the logic self.windowLevel = UIWindowLevelAlert - 1.

Sample images

API description

 
  1. @interface AUInputDialog : AUDialogBaseView
  2. /// The input box.
  3. @property (nonatomic, strong, readonly) UITextField *textField;
  4. /**
  5. Specify whether this instance is displayed. This applies when a pointer points at this instance.
  6. If another dialog box overrides this one, the attribute value is fixed as YES.
  7. */
  8. @property (nonatomic, assign, readonly) BOOL isDisplay;
  9. /**
  10. * The title.
  11. */
  12. @property (nonatomic, strong) NSString *title;
  13. /**
  14. * The text message.
  15. */
  16. @property (nonatomic, strong) NSString *message;
  17. /**
  18. The method of dialog box initialization without the button title.
  19. @param title The title.
  20. @param message The message details.
  21. @return The AUInputDialog instance.
  22. */
  23. - (instancetype)initWithTitle:(NSString *)title
  24. message:(NSString *)message;
  25. /**
  26. The AUInputDialog instance initialization method.
  27. @param title The title.
  28. @param message The message details.
  29. @param placeholder The placeholder in the text box.
  30. @param delegate The delegate object.
  31. @param buttonTitle The button title.
  32. @return The AUInputDialog instance.
  33. */
  34. - (instancetype)initWithTitle:(NSString *)title
  35. message:(NSString *)message
  36. placeholder:(NSString *)placeholder
  37. delegate:(id<AUDialogDelegate>)delegate
  38. buttonTitles:(NSString *)buttonTitle, ... NS_REQUIRES_NIL_TERMINATION;
  39. - (instancetype)initWithCustomView:(UIView *)customView; // The custom view.
  40. /// The disabled initialization method.
  41. - (instancetype)init NS_UNAVAILABLE;
  42. /**
  43. The dialog box display method.
  44. */
  45. - (void)show;
  46. /**
  47. The method of closing the dialog box. If will/didDismissWithButtonIndex is monitored, the index called back is 0 by default.
  48. */
  49. - (void)dismiss;
  50. /**
  51. Hide all dialog views in the dialog window.
  52. */
  53. + (void)dismissAll;
  54. /**
  55. Set the color of the text to gray. Default value: YES.
  56. */
  57. - (void)setGrayMessage:(BOOL)grayMessage;
  58. /**
  59. Set the text alignment mode.
  60. @param alignment The alignment mode.
  61. */
  62. - (void)setMessageAlignment:(NSTextAlignment)alignment;
  63. /**
  64. Add a button and its callback method.
  65. @param buttonTitle The button title.
  66. @param actionBlock The callback of the button tapping action.
  67. */
  68. - (void)addButton:(NSString *)buttonTitle actionBlock:(AUDialogActionBlock)actionBlock;

Code sample

  • Common style
 
  1. AUInputDialog *dialog = [[AUInputDialog alloc] initWithTitle:@"Title" message:@"The message may contain the sound icon and button of a notification alarm. This message can be sent to " placeholder:@"To friends." delegate:self buttonTitles:@"Cancel", @"Main action", nil];
  2. [dialog show];
  • Custom style
 
  1. UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 240, 60)];
  2. customView.backgroundColor = [UIColor greenColor];
  3. AUInputDialog *dialog = [[AUInputDialog alloc] initWithCustomView:customView];
  4. [dialog addButton:@"Cancel" actionBlock:nil];
  5. [dialog addButton:@"OK" actionBlock:nil];
  6. [dialog show];