I want to use TTTAttributedLabel to detect the link of the text in the Label of UITableViewCell, but it doesn't work. I'm using swift with iOS8. below is UITableViewCell code:
class StoryTableViewCell: UITableViewCell, TTTAttributedLabelDelegate {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
// Link properties
let textLabel = self.descriptionLabel
let linkColor = UIColor(red: 0.203, green: 0.329, blue: 0.835, alpha: 1)
let linkActiveColor = UIColor.blackColor()
if (textLabel is TTTAttributedLabel) {
var label = textLabel as TTTAttributedLabel
label.linkAttributes = [NSForegroundColorAttributeName : linkColor]
label.activeLinkAttributes = [NSForegroundColorAttributeName : linkActiveColor]
label.enabledTextCheckingTypes = NSTextCheckingType.Link.toRaw()
label.delegate = self
}
}
}