【发布时间】:2014-10-22 03:01:24
【问题描述】:
我想用TTTAttributedLabel检测UITableViewCell的Label中文字的链接,但是不行。我在 iOS8 上使用 swift。下面是 UITableViewCell 代码:
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
}
}
}
【问题讨论】:
-
@Prince 不行
标签: ios uitableview swift ios8 tttattributedlabel