当前位置:   article > 正文

YYKit 学习笔记之 YYLabel_pod 'yylabel

pod 'yylabel

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 setTextStrikethrough:deletDeco
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/729119
推荐阅读
相关标签
  

闽ICP备14008679号