CCPowerLabel
基于响应式编程和valist不定参原理,简化创建UILabel各种属性的代码
导入
#import "UILabel+Category.h"
1.不定参va_list传递
//..case 1,参数传递个数是不确定的,也就是说你想传几个就传几个,像NSTextAlignmentCenter和@“qwe”并不依赖于函数传递,可以直接作为参数
[label makeAttributes:@"qwe",
MakeTextAlignment(NSTextAlignmentCenter),
MakeBackgroundColor([UIColor redColor]),
MakeRect(0,0,100,100),
MakeTextColor([UIColor blueColor]),
MakeTextFont([UIFont systemFontOfSize:20.f]),
AddToSuperView(self.view),
nil];
2.类似Masonry的响应式编程方式
//..case 2
label.CBackgroundColor([UIColor redColor])
.CText(@"asdad")
.CTextColor([UIColor whiteColor])
.CTextAlignment(1)
.CFontSize(18.f)
.CRect(CGRectMake(0, 0, 100, 100))
.AddToSuperView(self.view);
下载地址:http://www.wenjiangs.com/wp-content/uploads/2021/docimg35/410ec4876d4cc095df3a16b54d3772ba.zip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论