RQAlertController.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // RQAlertController.h
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2018/10/12.
  6. // Copyright © 2018 Danson. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. typedef void (^AlertActionBlock) (UIAlertAction * _Nonnull action);
  11. typedef void (^RQAlertViewCompletion) (NSUInteger selectedOtherButtonIndex);
  12. @interface RQAlertController : UIAlertController
  13. /**
  14. * 在某个页面展示弹窗
  15. *
  16. * @author ZhangRong
  17. * @date 2018-10-12 11:27:55
  18. *
  19. * @param viewController 在该页面弹出
  20. * @param title 标题
  21. * @param message 副标题(可为nil)
  22. * @param alertControllerStyle 弹窗类型
  23. * @param cancelButtonTitle 取消按钮标题
  24. * @param otherButtonTitles 按钮标题数组
  25. * @param otherButtonStyles 按钮类型数组
  26. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  27. * @param completion 按钮点击回调
  28. */
  29. + (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  30. WithTitle:(nullable NSString *)title
  31. message:(nullable NSString *)message
  32. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  33. cancelButtonTitle:(nonnull NSString *)cancelButtonTitle
  34. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  35. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  36. preferredActionTitle:(nullable NSString *)preferredActionTitle
  37. completion:(nullable RQAlertViewCompletion)completion;
  38. /**
  39. * 展示弹窗(设置按钮文字加粗)
  40. *
  41. * @author ZhangRong
  42. * @date 2018-10-12 11:27:55
  43. *
  44. * @param title 标题
  45. * @param message 副标题(可为nil)
  46. * @param alertControllerStyle 弹窗类型
  47. * @param cancelButtonTitle 取消按钮标题
  48. * @param otherButtonTitles 按钮标题数组
  49. * @param otherButtonStyles 按钮类型数组
  50. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  51. * @param completion 按钮点击回调
  52. */
  53. + (void)showAlertWithTitle:(nullable NSString *)title
  54. message:(nullable NSString *)message
  55. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  56. cancelButtonTitle:(nonnull NSString *)cancelButtonTitle
  57. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  58. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  59. preferredActionTitle:(nullable NSString *)preferredActionTitle
  60. completion:(nullable RQAlertViewCompletion)completion;
  61. /**
  62. * 展示弹窗
  63. *
  64. * @author ZhangRong
  65. * @date 2018-10-12 11:27:55
  66. *
  67. * @param title 标题
  68. * @param message 副标题(可为nil)
  69. * @param alertControllerStyle 弹窗类型
  70. * @param cancelButtonTitle 取消按钮标题
  71. * @param otherButtonTitles 按钮标题数组
  72. * @param otherButtonStyles 按钮类型数组
  73. * @param completion 按钮点击回调
  74. */
  75. + (void)showAlertWithTitle:(nullable NSString *)title
  76. message:(nullable NSString *)message
  77. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  78. cancelButtonTitle:(nonnull NSString *)cancelButtonTitle
  79. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  80. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  81. completion:(nullable RQAlertViewCompletion)completion;
  82. @end
  83. NS_ASSUME_NONNULL_END