口袋优选

TYAlertView.h 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // TYAlertView.h
  3. // TYAlertControllerDemo
  4. //
  5. // Created by tanyang on 15/9/7.
  6. // Copyright (c) 2015年 tanyang. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. typedef NS_ENUM(NSUInteger, TYAlertActionStyle) {
  10. TYAlertActionStyleDefault,
  11. TYAlertActionStyleCancel,
  12. TYAlertActionStyleDestructive,
  13. };
  14. @interface TYAlertAction : NSObject <NSCopying>
  15. + (instancetype)actionWithTitle:(NSString *)title style:(TYAlertActionStyle)style handler:(void (^)(TYAlertAction *action))handler;
  16. @property (nonatomic, readonly) NSString *title;
  17. @property (nonatomic, readonly) TYAlertActionStyle style;
  18. @property (nonatomic, getter=isEnabled) BOOL enabled;
  19. @end
  20. @interface TYAlertView : UIView
  21. @property (nonatomic, weak, readonly) UILabel *titleLable;
  22. @property (nonatomic, weak, readonly) UILabel *messageLabel;
  23. // alertView textfield array
  24. @property (nonatomic, strong, readonly) NSArray *textFieldArray;
  25. // default 280, if 0 don't add width constraint,
  26. @property (nonatomic, assign) CGFloat alertViewWidth;
  27. // contentView space custom
  28. @property (nonatomic, assign) CGFloat contentViewSpace;
  29. // textLabel custom
  30. @property (nonatomic, assign) CGFloat textLabelSpace;
  31. @property (nonatomic, assign) CGFloat textLabelContentViewEdge;
  32. // button custom
  33. @property (nonatomic, assign) CGFloat buttonHeight;
  34. @property (nonatomic, assign) CGFloat buttonSpace;
  35. @property (nonatomic, assign) CGFloat buttonContentViewEdge;
  36. @property (nonatomic, assign) CGFloat buttonContentViewTop;
  37. @property (nonatomic, assign) CGFloat buttonCornerRadius;
  38. @property (nonatomic, strong) UIFont *buttonFont;
  39. @property (nonatomic, strong) UIColor *buttonDefaultBgColor;
  40. @property (nonatomic, strong) UIColor *buttonCancelBgColor;
  41. @property (nonatomic, strong) UIColor *buttonDestructiveBgColor;
  42. // textField custom
  43. @property (nonatomic, strong) UIColor *textFieldBorderColor;
  44. @property (nonatomic, strong) UIColor *textFieldBackgroudColor;
  45. @property (nonatomic, strong) UIFont *textFieldFont;
  46. @property (nonatomic, assign) CGFloat textFieldHeight;
  47. @property (nonatomic, assign) CGFloat textFieldEdge;
  48. @property (nonatomic, assign) CGFloat textFieldBorderWidth;
  49. @property (nonatomic, assign) CGFloat textFieldContentViewEdge;
  50. @property (nonatomic, assign) BOOL clickedAutoHide;
  51. + (instancetype)alertViewWithTitle:(NSString *)title message:(NSString *)message;
  52. - (void)addAction:(TYAlertAction *)action;
  53. - (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))configurationHandler;
  54. @end