UIKit框架 -02.UILabel

UIKit框架 -02.UILabel


1.基本概念

  • 文本标签,用来显示一串固定的文字的控件,仅仅只能用来显示文字,不能进行其他操作

这里写图片描述


2.UILabel的常见属性

@property(nullable, nonatomic,copy)   NSString           *text; // 设置文本内容
@property(null_resettable, nonatomic,strong) UIFont      *font; // 设置文字大小
@property(null_resettable, nonatomic,strong) UIColor     *textColor;// 设置文字的颜色
@property(nonatomic)NSTextAlignment textAlignment; // 设置文本的对齐方式
@property(nonatomic) NSInteger numberOfLines;// 设置文本的行数,设置为0时,代表自动换行

3.结合父类常见属性演示文本框实例

    label.text = @"我是改变后的文本";
    label.font = [UIFont systemFontOfSize:20.0];
    label.textColor = [UIColor redColor];
    label.textAlignment = NSTextAlignmentLeft;
    label.numberOfLines = 0;

    label.frame = CGRectMake(100, 100, 200, 200);
    label.bounds = CGRectMake(0, 0, 50, 50);
    label.tag = 10;
    label.backgroundColor = [UIColor grayColor];
  • 注意:凡是能够在storyboard上改变的属性,通过代码都能操作
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值