I'd like to copy all attributes from one NSMutableAttributedString
into a new one. The code i've tried is this:
[attrStr enumerateAttribute:NSFontAttributeName inRange:NSMakeRange(0, attrStr.length) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) {
if (value) {
// UIFont *oldFont = (UIFont *)value;
UIFont *newFont = [_label.attributedText
[attrStr removeAttribute:NSFontAttributeName range:range];
[attrStr addAttribute:NSFontAttributeName value:newFont range:range];
//found = YES;
}
}];
the code is clearly incomplete and it looks like its attempting to do it for fonts only. I'd like to loop through every attribute and add it into a new NSMutableAttributedString
variable. Update: my question is how do I apply all attributes of one NSMutableAttributedString
to another NSMutableAttributedString
?
Can we use this method somehow:attribute:atIndex:effectiveRange