代码库> 按钮> 一句代码为UIbutton增加不同状态的配置(borderColor, titleLabelFont, backgroundColor,subView)
一句代码为UIbutton增加不同状态的配置(borderColor, titleLabelFont, backgroundColor,subView)
关注
上传者:_零玖 分类:按钮(Button)
查看次数:1943 下载次数:171
上传时间:2016-10-22 大小:238 B
使用一句代码为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]}];
收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0
提示
sina weixin mail 回到顶部