3

I am using TTTAttributedLabel (https://github.com/twotoasters/TTTAttributedLabel). Here I'm correctly getting the label with some clickable text.

enter image description here

I need to display my text like the username in above image(ie. without underline).How could I do that?

Wez Sie Tato
  • 1,186
  • 12
  • 33
nithin
  • 2,457
  • 1
  • 30
  • 50
  • comment [self.summaryLabel addLinkToURL:url withRange:linkRange]; and try. As addLinkToURL method make underline in the text. It may help you. – LittleIDev May 03 '13 at 07:35

3 Answers3

9

Try this code (sorry for formatting, written on phone...)

NSDictionary *linkAttributes = @{[NSNumber numberWithInt:kCTUnderlineStyleNone] : (id)kCTUnderlineStyleAttributeName};
self.label.linkAttributes = linkAttributes;
Wain
  • 118,658
  • 15
  • 128
  • 151
0

For swift 4.0

   let LinkAttributes = NSMutableDictionary(dictionary: testLink.linkAttributes)
   LinkAttributes[NSAttributedStringKey.underlineStyle] =  NSNumber(value: false)
   yourLabel.linkAttributes = LinkAttributes as NSDictionary as! [AnyHashable: Any]
guru
  • 2,727
  • 3
  • 27
  • 39
0

if you are already having label with underline style and if you want to remove it programatically use the following code

 let string = "your text"
 let attributes: [NSAttributedString.Key: Any] = [
                .font: UIFont.systemFont(ofSize: 13)
            ]
 let attributedString = NSAttributedString(string: string, 
 attributes: attributes)
 yourLabel.attributedText = attributedString