mattt/TTTAttributedLabel — pull request #326 by iwasrobbed (2014-02-26 21:29:03+00:00)
Title: linkAttributes should override all other attributes within the link's range

Hey Mattt,

I've come across a scenario where `addLinkToURL:withRange:` does not respect the `linkAttributes` and instead keeps the original attributes that were given when the `NSAttributedString` was created.

The issue exists because it is currently using `addAttributes` versus `setAttributes` in https://github.com/mattt/TTTAttributedLabel/blob/master/TTTAttributedLabel/TTTAttributedLabel.m#L513 so there's no guarantee which attribute it will keep if there are pre-existing attributes in that range.

I would expect the `linkAttributes` to take precedence versus attempting (and failing in this case) to be additive. I've patched it to work and updated the docs, but it may break other people's implementations if they have been assuming it was additive all this time.

An example that causes it to fail:
- I created a basic attributed string with a gray foreground color
- I then setup the `TTTAttributedLabel` like so:
```objC
self.tttLabel.linkAttributes = @{ (id)kCTForegroundColorAttributeName : kSomeColorHere,
(id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:kCTUnderlineStyleNone] };
```
- Then I set the text using `setText:` and add a link (which I've verified is tappable in the UI)

However, when displayed, the link is still the gray foreground color instead of taking on the `linkAttributes`