CocoaPods trunk is moving to be read-only. Read more on the blog, there are 8 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Aug 2017 |
Maintained by suhc.
在介绍此框架的具体内容之前,先大致介绍一下此框架的由来。转眼做iOS开发也有几年了,工作中也踩过各种各样的坑,写过无数的demo,也总结了不少东西,但是一直都是自己和身边的朋友在自己公司的项目中使用,传播方式也仅限于利用QQ、微信,从来也没想着公开出来。后来的感慨就是,之前明明已经写过的许多功能,后来再次用到的时候却发现有很多都找不到了,还得重复去写,也是有感于此吧,所以就想把自己平时总结出来的一些方法和功能集中到一起,让自己和朋友们一起进行完善,在需要的时候直接拿来使用,不会担心丢失,而且经过众多大牛,而不是仅仅自己的力量进行完善,可以让这些功能更加的强大,更加的强健,这也就是此项目的意义和由来。
$ pod 'HCTools'
//设置富文本label
HCAttributeLabel *label = [[HCAttributeLabel alloc]initWithFrame:CGRectMake(100, 100, 360, 120)];
label.text = @"<富文本效果展示>:我们都有一个[test],名字叫<中国>!❤️我<中华>,因为我们\\[都是\\]\\<炎黄子孙\\>\n<以下是自定义Button效果展示>";
label.highlightFont = [UIFont systemFontOfSize:18];
label.textColor = [UIColor greenColor];
label.highlightColor = [UIColor redColor];
label.backgroundColor = [UIColor blueColor];
label.font = [UIFont systemFontOfSize:16];
label.lineSpacing = 10;
label.center = self.view.center;
label.textAlignment = NSTextAlignmentCenter;
label.HighlightAction = ^(NSString *string){
NSLog(@"string:%@",string);
};
[self.view addSubview:label];
//创建一个图片在左,文字在右边,图片和文字距离为10,上边距离label为20的Button
HCCustomButton *button1 = [HCCustomButton customButtonWithType:HCCustomButtonTypeDefault];
[button1 setTitle:@"图片在左,文字在右" forState:UIControlStateNormal];
button1.padding = 10;
[button1 setImage:[UIImage imageNamed:@"test"] forState:UIControlStateNormal];
button1.backgroundColor = [UIColor blueColor];
button1.top = label.bottom + 20;
button1.centerX = self.view.centerX;
[self.view addSubview:button1];
//创建一个图片在右,文字在左,图片和文字距离为10,上边距离button1为20的Button
HCCustomButton *button2 = [HCCustomButton customButtonWithType:HCCustomButtonTypeImageOnRight];
[button2 setTitle:@"图片在右,文字在左" forState:UIControlStateNormal];
button2.padding = 10;
[button2 setImage:[UIImage imageNamed:@"test"] forState:UIControlStateNormal];
button2.backgroundColor = [UIColor blueColor];
button2.top = button1.bottom + 20;
button2.centerX = self.view.centerX;
[self.view addSubview:button2];
//创建一个图片在上,文字在下,图片和文字距离为10,上边距离button2为20的Button
HCCustomButton *button3 = [HCCustomButton customButtonWithType:HCCustomButtonTypeImageOnTop];
[button3 setTitle:@"图片在上,文字在下" forState:UIControlStateNormal];
button3.padding = 10;
[button3 setImage:[UIImage imageNamed:@"test"] forState:UIControlStateNormal];
button3.backgroundColor = [UIColor blueColor];
button3.top = button2.bottom + 20;
[self.view addSubview:button3];
button3.centerX = self.view.centerX;
//创建一个图片在下,文字在上,图片和文字距离为10,上边距离button3为40的Button
HCCustomButton *button4 = [HCCustomButton customButtonWithType:HCCustomButtonTypeImageOnBottom];
[button4 setTitle:@"图片在下,文字在上" forState:UIControlStateNormal];
button4.padding = 10;
[button4 setImage:[UIImage imageNamed:@"test"] forState:UIControlStateNormal];
button4.backgroundColor = [UIColor blueColor];
button4.top = button3.bottom + 20;
button4.centerX = self.view.centerX;
[self.view addSubview:button4];