关于UILabel

一:建立一个label字体

UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(15, 100, 345, 100)];spa

二:UILabel的一些属性blog

(1) 设置文字:label.text =   @"这是个人一个Label";it

(2) 设置文字颜色:label.textColor = [UIColor redColor];class

(3) 对齐方式:label.textAlignment = NSTextAlignmentCenter;im

(4) 字体:label.font = [UIFont systemFontOfSize:30.f];img

(5) 获取字体:NSLog(@"%@",[UIFont familyNames]);tab

(6) 设置行数:label.numberOfLines = 0;co

(7) 设置字体阴影:label.shadowColor = [UIColor cyanColor];background

    label.shadowOffset = CGSizeMake(2, 1);

(8) 设置label的颜色:label.backgroundColor = [UIColor blackColor];

效果以下:

相关文章
相关标签/搜索