UILable

作者: MarkTang | 来源:发表于2016-01-11 01:08 被阅读53次

UILable

summary

UILabel极其常用,功能比较专一:显示文字

UILabel的常见属性

@property(nonatomic,copy)   NSString           *text; 
显示的文字
@property(nonatomic,retain) UIFont             *font; 
字体
@property(nonatomic,retain) UIColor            *textColor; 
文字颜色
@property(nonatomic)        NSTextAlignment    textAlignment; 
对齐模式(比如左对齐、居中对齐、右对齐) 
@property(nonatomic) NSInteger numberOfLines; 
文字行数
@property(nonatomic)        NSLineBreakMode    lineBreakMode;
换行模式

UIFont类

UIFont代表字体
  • Method
+(UIFont *)systemFontOfSize:(CGFloat)fontSize;          系统默认字体
+ (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;     粗体
+ (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize;   斜体
    

Demo

    
    // 改变文本的内容
    self.label.text = @"我是红色";
    //设置lebel背景颜色
    self.textLbel.backgroundColor = [UIColor grayColor];
    // 文字居中
    self.label.textAlignment = NSTextAlignmentCenter;
   
    //设置lebel字体大小               系统字体
    self.textLbel.font = [UIFont systemFontOfSize:19.f];
    + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;  粗体
    + (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize;  斜体
   
    //设置lebel字体颜色
    self.textLbel.textColor = [UIColor blackColor];
    //设置lebel字体对其方式
    self.textLbel.textAlignment = NSTextAlignmentCenter;
    //设置lebel字体阴影颜色
    self.textLbel.shadowColor = [UIColor blueColor];
    //设置lebel字体偏移量
    self.textLbel.shadowOffset = CGSizeMake(-2, 3);
    //设置lebel行数 0表示自动换行
    self.textLbel.numberOfLines = 0;
    //设置lebel字体显示方式
    self.textLbel.lineBreakMode = NSLineBreakByTruncatingTail;

相关文章

  • iOS 小知识

    UILabel 通过文字计算宽高 UILable *lable=[UILable alloc]init]; lab...

  • iOS加载Html文本

    UILable||UITextView加载html 使用UILable或TextView比较方便,但是字体样式无法...

  • iOS开发初级(一、基础002)

    UILable、UIImageView、UIButton的拓展:三个控件,当显示文字时,使用UILable,当显示...

  • UILabel顶格显示

    UILable的Category

  • UILable

    UILable是UIKit下的控件,继承UIView,是iOS开发常用的控件。 项目中一般的用法: 多行显示 如果...

  • UILable

    UILable 是一个只读的文本视图,使用这个类绘制单行或者多行的静态文本。你可以将 UILable 作为你界面的...

  • UILable

    /显示下划线 //中划线 // NSDictionary *attribtDic = @{NSStriket...

  • UILable

    UILable summary UILabel的常见属性 UIFont类 Method Demo

  • UILable

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen ...

  • IOS开发 UILabel标签控件

    本节学习内容: 1.UILable的概念 2.UILabel的基本属性 3.UILable的高级属性 [项目名称:...

网友评论

      本文标题:UILable

      本文链接:https://www.haomeiwen.com/subject/zlvqkttx.html