常用到的属性字符串

///定义属性字符串
NSMutableAttributedString *att = [[NSMutableAttributedString alloc]initWithString:@""]; ///删除线 [att addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlineStyleSingle | NSUnderlineStyleSingle) range:NSMakeRange(0, 0)]; ///字体大小 UIFont *font = [UIFont fontWithName:@"Helvetica-Bold" size:17.0]; [att addAttribute:NSFontAttributeName value:font range:NSMakeRange(0,0)]; ///字体颜色 [att addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 0)]; // 下划线 [att addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, 0)];

直接赋给label就可以了

相关文章:

  • 2021-12-12
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
相关资源
相似解决方案