UILabel定义
UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 50)];
UILabel的属性
- 背景色:label.backgroundColor=[UIColor redColor];
- label文字内容:label.text=@”标签文字”;
- label中文字对齐方式:label.textAlignment=NSTextAlignmentCenter;
- 文字的颜色:label.textColor=[UIColor blackColor];
- 文字的大小:label.font=[UIFont systemFontOfSize:50];
- label阴影:label.shadowColor=[UIColor greenColor];label.shadowOffset=CGSizeMake(2, 2);
- 设置行数:label.numberOfLines=2;
- 圆角:label.layer.cornerRadius=5;label.layer.masksToBounds=YES;
本文详细介绍了UILabel的各种属性及其使用方法,包括背景色、文字内容、对齐方式、文字颜色、文字大小、阴影效果、行数限制及圆角效果等。
393

被折叠的 条评论
为什么被折叠?



