您的位置:首页 > 产品设计 > UI/UE

UiLabel的属性和用法

2013-01-07 14:57 134 查看
/************************************************************************************************

UILabel * scoreLabel=[[UILabel alloc]initWithFrame:CGRectMake(50.0, 50.0, 150.0, 43.0)]

[scoreLabel setBackgroundColor:[UIColor clearColor]]; //设置背景颜色为透明,之外你还可以使用自定义的颜色:

[scoreLabel setText:@"好好学习,天天向上"]; //设置显示文字

[scoreLabel setTextColor:[UIColor blackColor]];//设置显示文字的颜色,可以设置多种颜色

[scoreLabel setTextAlignment:NSTextAlignmentCenter];//设置文字对齐位置居中 /**********************************************************************************

[scoreLabel setTextAlignment:NSTextAlignmentLeft];//设置文字对齐位置居左

[scoreLabel setTextAlignment:NSTextAlignmentRight];//设置文字对齐位置右

***********************************************************************************/

[scoreLabel setFont:[UIFont fontWithName:@"accbound" size:(25.0)]];//设置字体的类型,为粗体 调用系统的字体配置。 [scoreLabel setAdjustsFontSizeToFitWidth:YES];//设置字体的大小是否适应lable的宽度。

[scoreLabel setShadowColor:[UIColor redColor]]; //设置阴影颜色.

[scoreLabel setShadowOffset:CGSizeMake(1.0, 1.0)];//设置阴影偏移位置.

[scoreLabel setUserInteractionEnabled:YES]; //设置进行交互

[scoreLabel setHighlighted:YES];//设置文本是否高亮

[scoreLabel setHighlightedTextColor:[UIColor blueColor]]; //设置文本高亮时的颜色

[scoreLabel setHidden:NO];//设置一开始是否将label进行隐藏

[scoreLabel setNumberOfLines:1]; //设置lable的行数,这个也可以选择一个适应的高度

[self.view addSubview:scoreLabel];

*********************************************************************************/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: