原文:https://blog.csdn.net/dolacmeng/article/details/81204469
需求如图,UILabel要实现带红色边的文字显示。
1、新建UILabel的子类JXBorderLabel
2、重写drawRect:方法
#import "JXBorderLabel.h"
@implementation JXBorderLabel
- (void)drawRect:(CGRect)rect {
//1.获取上下文
CGContextRef context = UIGraphicsGetCurrentContext();
//2.给上下文线段设置线宽,...
swift 中的UILabel属性用法及介绍
1.创建
letlabel =UILabel(frame:CGRect(x:30,y:100,width:200,height:40))
view.addSubview(label)
2.设置背景颜色
label.backgroundColor=UIColor.cyan;
3.设置文本字
label.text="xingweixin zhamaotu "
4.设置字体颜色
label.textColor=UIColor.red
5.字体设置
设置字体样式和大小
label.font=UIFont(name:"Zapfino",size:15)
设置字体大小
label.font=UIF...