簡介
對于基本的使用請查看我的上一篇文章 http://www.itdecent.cn/p/ba8e986cdd0c"
github地址有demo演示
https://github.com/JunAILiang/JMButton
一張圖看懂JMButton

JMButtonAll.png
更新內容
- 新增一行代碼實現(xiàn)倒計時按鈕
- 新增計數(shù)器按鈕如何使用 (仿淘寶, 美團, 餓了嗎, 百度外賣等)
- 新增水波紋點擊效果
一行代碼實現(xiàn)倒計時按鈕功能
//一行代碼實現(xiàn)倒計時
[bsBtn startCountDown:6];
你還可以高度自定義倒計時按鈕的樣式配置
/** 倒計時中背景顏色(默認 不設置) */
@property (nonatomic, strong) UIColor *countDownBackground;
/** 倒計時完成后背景顏色 (默認 不設置) */
@property (nonatomic, strong) UIColor *countDownDoneBackground;
/** 倒計時邊框顏色 (默認 不設置) */
@property (nonatomic, strong) UIColor *countDownBorderColor;
/** 倒計時完成后邊框顏色 (默認 不設置) */
@property (nonatomic, strong) UIColor *countDownDoneBorderColor;
計數(shù)器如何使用
JMNumberButtonConfig *buttonConfig = [JMNumberButtonConfig buttonConfig];
buttonConfig.shakeAnimation = YES; //開啟抖動動畫
JMNumberButton *numberBtn = [[JMNumberButton alloc] initWithFrame:CGRectMake(50, 100, 120, 40) NumberButtonConfig:buttonConfig];
[self.view addSubview:numberBtn];
你也可以高度自定義
typedef NS_ENUM(NSInteger, JMNumberButtonType) {
JMNumberButtonTypeNormal, //默認樣式
JMNumberButtonTypeTaoBao, //仿淘寶樣式
JMNumberButtonTypeJingDong, //仿京東樣式
JMNumberButtonTypeMeiTuan, //仿美團 餓了嗎 百度外賣 樣式
};
@interface JMNumberButtonConfig : NSObject
/** 初始化 */
+ (instancetype)buttonConfig;
/********************* 樣式配置 *********************/
/** 樣式 */
@property (nonatomic, assign) JMNumberButtonType numberButtonType;
/** 是否開啟抖動動畫 (默認 NO) */
@property (nonatomic, assign) BOOL shakeAnimation;
/********************* 輸入框配置 *********************/
/** 輸入框中的內容 (默認 1) */
@property (nonatomic, assign) NSInteger currentNumber;
/** 輸入框中字體大小 (默認 20.f )*/
@property (nonatomic, strong) UIFont *inputFont;
/** 輸入框是否可輸入 (默認 YES) */
@property (nonatomic, assign) BOOL isInput;
/** 邊框線條寬度 (默認 0 0的話不會展示) */
@property (nonatomic, assign) CGFloat borderLineWidth;
/** 邊框線條顏色 (默認 #eeeeee) */
@property (nonatomic, strong) UIColor *borderLineColor;
/** 圓角值 ( 默認 3.f 如果設置了numberButtonType, 圓角值將無效 ) */
@property (nonatomic, assign) CGFloat cornerRadius;
/********************* 按鈕配置 *********************/
/** 加減按鈕字體大小 (默認 30.f) */
@property (nonatomic, strong) UIFont *buttonTitleFont;
/** 加按鈕背景顏色 (默認 #FFFFFF) */
@property (nonatomic, strong) UIColor *increaseBackgroundColor;
/** 減按鈕背景顏色 (默認 #FFFFFF)*/
@property (nonatomic, strong) UIColor *decreaseBackgroundColor;
/** 加按鈕背景圖片 (默認 nil 圖片的設置優(yōu)先級高于背景顏色) */
@property (nonatomic, strong) UIImage *increaseBackgroundImage;
/** 減按鈕背景圖片 (默認 nil) */
@property (nonatomic, strong) UIImage *decreaseBackgroundImage;
/** 加按鈕標題 (默認 +) */
@property (nonatomic, strong) NSString *increaseTitle;
/** 減按鈕標題 (默認 -) */
@property (nonatomic, strong) NSString *decreaseTitle;
/** 加按鈕contentEdgeInsets (默認 0, 0, 3, 0) */
@property (nonatomic, assign) UIEdgeInsets increaseContentEdgeInsets;
/** 減按鈕contentEdgeInsets (默認 0, 0, 3, 0) */
@property (nonatomic, assign) UIEdgeInsets decreaseContentEdgeInsets;
/********************* 其他配置 *********************/
/** 最小值 (默認 1)*/
@property (nonatomic, assign) NSInteger minNumber;
/** 最大值 (默認 無限制)*/
@property (nonatomic, assign) NSInteger maxNumber;
水波紋點擊效果
//默認樣式
JMWaveButtonConfig *buttonConfig = [JMWaveButtonConfig buttonConfig];
buttonConfig.highlightedColor = [UIColor redColor];
buttonConfig.bootstrapType = JMBootstrapTypePurple;
JMButton *waveBtn = [[JMButton alloc] initWithFrame:CGRectMake(50, 100, 160, 60) ButtonConfig:buttonConfig];
[self.view addSubview:waveBtn];