No Description

UIButton+KXExtension.h 992B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // UIButton+KXExtension.h
  3. // CAISHEN
  4. //
  5. // Created by jikaipeng on 2018/9/4.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <objc/runtime.h>
  10. typedef NS_ENUM(NSUInteger, KXButtonType)
  11. {
  12. KXButtonTypeRedButton = 1,
  13. };
  14. typedef void (^ButtonActionBlock)();
  15. @interface UIButton (KXExtension)
  16. /*
  17. 按钮的点击事件快速实现
  18. */
  19. @property (nonatomic, assign) KXButtonType buttonType;
  20. - (void)addActionBlockWith:(UIControlEvents)controlEvent withBlock:(ButtonActionBlock)block;
  21. + (instancetype)buttonWithKXButtonType:(KXButtonType)type;
  22. /**
  23. 快速创建一个按钮
  24. @param title normal下按钮的标题
  25. @param color normal下按钮的字体颜色
  26. @param font normal下按钮字体的大小
  27. @param target target
  28. @param action 方法
  29. @return 返回一个按钮的实例
  30. */
  31. + (UIButton *)createBtnWithTitle:(NSString *)title titleColor:(UIColor *)color font:(UIFont *)font target:(id)target selector:(SEL)action;
  32. @end