文件名称:ios-一句代码为UIbutton增加不同状态的配置(borderColor, titleLabelFont, backgroundColor,subView).zip
文件大小:238KB
文件格式:ZIP
更新时间:2022-07-31 13:49:47
按钮
使用一句代码为UIbutton增加不同状态的配置(borderColor, titleLabelFont, backgroundColor,subView) 最新代码请移步github: https://github.com/spWang/UIButton-State 如果在使用过程中发现问题,请联系我,wsp810@163.com,如果觉得好用please give a star, 谢谢! 用法如: //setBackgroundColor 1. [button hcb_setBackgroundColor:[UIColor redColor] forState:UIControlStateNormal animated:YES]; //setborderColor 2. button.layer.borderWidth = 10; [button hcb_setborderColor:[UIColor purpleColor] forState:UIControlStateNormal animated:YES]; //setTitleLabelFont 3. [button hcb_setTitleLabelFont:[UIFont systemFontOfSize:10] forState:UIControlStateNormal]; //配置SubView 4. [button hcb_setSubViewValue:@(NSTextAlignmentLeft) forKeyPath:@"textAlignment" forState:UIControlStateNormal withSubViewTag:10001]; //使用key-Value方案来配置 5. [button hcb_configBackgroundColors:@{@(UIControlStateNormal) : [UIColor redColor], @(UIControlStateSelected) : [UIColor blueColor]}];