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

  • 關於本站
  • 免責聲明