iOS UILabel 文本颜色设置

0x01 这也需要讨论?

不就是 label.textColor = [UIColor redColor];


0x02 另外的方法呢?

setValue:forKey:
[label setValue:[UIColor greenColor] forKey:@"textColor"];


0x03 还有吗?

performSelector:withObject:

[label3 performSelector:@selector(setTextColor:) withObject:[UIColor blueColor]];


0x04 其实还有

[label setValue:[UIColor blueColor] forKey:@"color"];
[label performSelector:@selector(setColor:) withObject:[UIColor blueColor]];

对应的方法:setColor:
虽然系统没提供出来
但内部是支持的


0x05 更多

测试过UITextFieldUITextView
不支持方法:setColor:

看来是UILabel独有的


一行代码搞定视图圆角

https://github.com/xjh093/JHViewCorner


你可能感兴趣的:(iOS)