How can I initialize an NSAttributedString
with a ranged attribute?
As it stands, I can only work out how to add a ranged attribute after initialization, which obviously doesn't work for immutable NSAttributedString
instances.
If I have an NSMutableAttributedString
, I can call:
[str addAttribute:NSLinkAttributeName value:url range:range];
If I have an NSAttributedString
, I can construct it:
[[NSAttributedString alloc] initWithString:str attributes:@{NSLinkAttributeName: url}];
But I can't find a way to put a range into the attributesDict.
Thanks,