Getting a TTTAttributedLabel to print bold

561 Views Asked by At

Trying to use the TTTAttributedLabel framework for the first time. I want to use it to make part of my UILabel printed in a bold font and the other part printed light font:

let messageLabelString = "\(notificationSenderName) would like to rent your \(notificationItem). Approve?"
cell.messageLabel.text = messageLabelString
let nsString = messageLabelString as NSString
let range = nsString.rangeOfString(notificationSenderName)
let url = NSURL(string: "test")
cell.messageLabel.addLinkToURL(url, withRange: range)
cell.messageLabel.delegate = self

This is what it looks like right now:

enter image description here

I however don't want the blue and underlined font I just want to get a black and bold font. How do I do this?

1

There are 1 best solutions below

0
On BEST ANSWER

Was able to do what I wanted through:

let messageLabelString = "\(notificationSenderName) would like to rent your \(notificationItem). Approve?"
            cell.messageLabel.text = messageLabelString
            let nsString = messageLabelString as NSString
            let range = nsString.rangeOfString(notificationSenderName)
            let url = NSURL(string: "test")

            let subscriptionNoticeLinkAttributes = [
                NSFontAttributeName: UIFont(name:"JohnstonITCPro-Bold", size:15)!
                ]

            cell.messageLabel.linkAttributes = subscriptionNoticeLinkAttributes
            cell.messageLabel.addLinkToURL(url, withRange: range)
            cell.messageLabel.delegate = self