财神随手记账

TXBYAlertView.h 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // TXBYAlertView.h
  3. // TXBYAlertViewDemo
  4. //
  5. // Created by fergusding on 15/5/26.
  6. // Copyright (c) 2015年 fergusding. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @protocol TXBYAlertViewDelegate;
  10. @interface TXBYAlertView : UIView
  11. @property (strong, nonatomic) UIView *contentView;
  12. @property (strong, nonatomic) UIImage *icon;
  13. @property (strong, nonatomic) NSString *title;
  14. @property (strong, nonatomic) NSString *message;
  15. @property (weak, nonatomic) id<TXBYAlertViewDelegate> delegate;
  16. - (instancetype)initWithTitle:(NSString *)title icon:(UIImage *)icon message:(NSString *)message delegate:(id<TXBYAlertViewDelegate>)delegate buttonTitles:(NSString *)buttonTitles, ... NS_REQUIRES_NIL_TERMINATION;
  17. typedef void (^alertClickBlock)(NSInteger index);
  18. /**
  19. * 用于回调cell的block
  20. */
  21. @property (nonatomic, copy) alertClickBlock block;
  22. /**
  23. * 显示alertView
  24. */
  25. - (void)show;
  26. /**
  27. * 显示alertView 带点击回调
  28. */
  29. - (void)showWithClickBlock:(alertClickBlock)block;
  30. /**
  31. * 快速创建一个alertView 带点击回调
  32. */
  33. + (TXBYAlertView *)alertWithTitle:(NSString *)title message:(NSString *)message buttonTitles:(NSString *)btnTitles, ... NS_REQUIRES_NIL_TERMINATION;
  34. /**
  35. * 隐藏
  36. */
  37. - (void)hide;
  38. /**
  39. * 设置标题颜色 默认黑色
  40. * 设置标题字体 默认14.0
  41. */
  42. - (void)setTitleColor:(UIColor *)color fontSize:(CGFloat)size;
  43. /**
  44. * 设置内容颜色 默认黑色
  45. * 设置内容字体 默认12.0
  46. */
  47. - (void)setMessageColor:(UIColor *)color fontSize:(CGFloat)size;
  48. /**
  49. * 设置每个按钮颜色 默认黑色
  50. * 设置内容字体 默认16.0
  51. */
  52. - (void)setButtonTitleColor:(UIColor *)color fontSize:(CGFloat)size atIndex:(NSInteger)index;
  53. @end
  54. /**
  55. * 点击协议 可用showWithClickBlock方法替代
  56. */
  57. @protocol TXBYAlertViewDelegate <NSObject>
  58. - (void)alertView:(TXBYAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
  59. @end