logo
  • 教程列表
  • SO官方文档
  • NSAttributedString
    • 创建具有自定义字距调整的字符串(字母间距)
    • 更改单词或字符串的颜色
    • 使用删除线文本创建一个字符串
    • 在 Swift 中附加归属字符串和粗体文本
    • 删除所有属性
  1. StackOverflow 文档
  2. iOS 教程
  3. NSAttributedString
  4. 删除所有属性

删除所有属性

Created: November-22, 2018

Objective-C

NSMutableAttributedString *mutAttString = @"string goes here";
NSRange range = NSMakeRange(0, mutAttString.length);
[mutAttString setAttributes:@{} range:originalRange];

根据我们使用的 Apple 文档,setAttributes 而不是 addAttribute。

迅速

mutAttString.setAttributes([:], range: NSRange(0..<string.length))
  • 在 Swift 中附加归属字符串和粗体文本

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明