YYKit 学习笔记之 YYLabel

本文是关于YYKit的学习笔记,重点介绍了如何通过Cocoapods安装YYKit,并详细讲解了YYLabel的使用。安装步骤包括修改Podfile,添加'YYKit', '~> 1.0.9',然后执行pod install。YYKit包含多个组件,如YYModel、YYCache、YYImage等,但本文主要关注YYText框架中的YYLabel,它是一个功能强大的富文本框架。" 78992428,6943737,理解与模拟实现memcpy函数,"['C语言', '函数实现', '内存管理']
摘要由CSDN通过智能技术生成

YYKit 学习笔记之 YYLabel


使用Cocoapods安装YYKit
YYKit GitHub传送门:https://github.com/ibireme/YYKit
一.打开工程的 Podfile文件
二.在Podfile文件中添加pod ‘YYKit’, ‘~> 1.0.9’
三.终端进入工程目录,执行pod install

YYKit 添加成功

添加头文件
#import <YYKit/YYKit.h>

NSString *textStr = @"The YYLabel class implements a read-only text view,这是删除样式~~这是下划线样式~~这是带边框样式,这是带阴影样式,点击交互事件,添加点击事件,分割分割分割";
    YYLabel * label = [[YYLabel alloc] initWithFrame:CGRectZero];
    label.backgroundColor = [UIColor grayColor];
    label.numberOfLines = 0;
    label.textVerticalAlignment =  YYTextVerticalAlignmentTop;//垂直属性,上  下 或居中显示

 //富文本属性
    NSMutableAttributedString  * attriStr = [[NSMutableAttributedString alloc] initWithString:textStr];

 //设置行间距
    attriStr.lineSpacing = 10;
    attriStr.font = [UIFont systemFontOfSize:20];
   
    //富文本属性 
 NSRange range =[textStr rangeOfString:@"The YYLabel class implements a read-only text view"];
    [attriStr setFont:[UIFont boldSystemFontOfSize:30] range:range];

 //删除样式
    NSRange range2 =[textStr rangeOfString:@"这是删除样式" options:NSCaseInsensitiveSearch];
    YYTextDecoration *deletDecoration = [YYTextDecoration decorationWithStyle:YYTextLineStyleSingle width:@(1) color:[UIColor redColor]];
    [attriStr setT
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值