删除所有属性

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))