1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //
- // UIButton+KXExtension.h
- // CAISHEN
- //
- // Created by jikaipeng on 2018/9/4.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #import <objc/runtime.h>
- typedef NS_ENUM(NSUInteger, KXButtonType)
- {
- KXButtonTypeRedButton = 1,
- };
- typedef void (^ButtonActionBlock)();
- @interface UIButton (KXExtension)
- /*
- 按钮的点击事件快速实现
- */
- @property (nonatomic, assign) KXButtonType buttonType;
- - (void)addActionBlockWith:(UIControlEvents)controlEvent withBlock:(ButtonActionBlock)block;
- + (instancetype)buttonWithKXButtonType:(KXButtonType)type;
- /**
- 快速创建一个按钮
- @param title normal下按钮的标题
- @param color normal下按钮的字体颜色
- @param font normal下按钮字体的大小
- @param target target
- @param action 方法
- @return 返回一个按钮的实例
- */
- + (UIButton *)createBtnWithTitle:(NSString *)title titleColor:(UIColor *)color font:(UIFont *)font target:(id)target selector:(SEL)action;
- @end
|