[attributedString enumerateAttributesInRange:range options:NSAttributedStringEnumerationReverse usingBlock:
^(NSDictionary *attributes, NSRange range, BOOL *stop) {
NSMutableDictionary *mutableAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[mutableAttributes setObject:[NSNumber numberWithInt:1] forKey:@"NSUnderline"];
attributes = mutableAttributes;
}];
我正在尝试遍历所有属性并将 NSUnderline 添加到它们。调试时,似乎 NSUnderline 已添加到字典中,但是当我第二次循环时,它们被删除了。更新 NSDictionaries 时我做错了吗?