现在的位置: 首页 > 综合 > 正文

UILabe 的属性和用法

2013年12月13日 ⁄ 综合 ⁄ 共 703字 ⁄ 字号 评论关闭

  UILabel *title = [[UILabel
alloc] initWithFrame:CGRectMake(100,
7, 120,
30)];

解析:

Initializes and returns a newly allocated view object with the specified frame rectangle.

    title.backgroundColor = [UIColor
clearColor];

解析:设置背景颜色

    title.text = @"选择相册";

解析:设置显示的文字

    title.font = [UIFont
systemFontOfSize:20];

解析:设置显示的字体

    title.textColor = [UIColor
colorWithWhite:0.4
alpha:1.0];

解析:设置显示的文字颜色

 title.textAlignment = UITextAlignmentRight;     

 title.textAlignment = UITextAlignmentCenter;  

解析:设置对应的位置

title.highlighted=YES;

title.highlightedTextColor=[UIColor brownColor];

解析:设置高亮

 title.shadowColor=[UIColor blueColor];

 title.shadowColor=[UIColor blueColor];

解析:设置阴影

   //设置文字过长时的显示格式 
   

    title.lineBreakMode = UILineBreakModeMiddleTruncation;//截去中间  




抱歉!评论已关闭.