こんにちは。早速本題です。
tableViewCellにTTTAttributedLabelをclassとしたLabelを置きました。
リンク内容リンク先を参考に実装しています。
下記が関連していそうなtableViewCellの内容です。
swift
1//cell 2import UIKit 3import TTTAttributedLabel 4 5 6class TableViewCell: UITableViewCell,TTTAttributedLabelDelegate{ 7 8 @IBOutlet weak var label1: TTTAttributedLabel! 9 10 override func awakeFromNib() { 11 super.awakeFromNib() 12 // Initialization code 13 14 } 15 16 override func setSelected(_ selected: Bool, animated: Bool) { 17 super.setSelected(selected, animated: animated) 18 19 // Configure the view for the selected state 20 } 21 22 func setCell(textLabel:String,select:Bool){ 23 24 25 26 label1.enabledTextCheckingTypes = NSTextCheckingResult.CheckingType.link.rawValue 27 28 label1.text = textLabel 29 30 label1.delegate = self 31} 32 func attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) { 33 //処理 34 } 35} 36
label1.enabledTextCheckingTypes = NSTextCheckingResult.CheckingType.link.rawValue
この一文でエラーが出ているようでアプリがクラッシュしています。
エラー文には
libc++abi.dylib: terminating with uncaught exception of type NSException
と出ています。接続を確認してみましたがおそらく大丈夫です。
TTTAttributedLabeを使うのは初めてなのでつまずいてしまいました。
label上のlinkを実装できるようにするにはこれからどのようにすれば良いですか。必要な情報があればお聞きください。分かる方返信お待ちしています。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/23 09:14
2018/05/23 10:26
2018/05/23 13:01
2018/05/23 13:14
2018/05/23 13:23 編集
2018/05/23 13:24
2018/05/23 13:26
2018/05/23 13:45
2018/05/23 13:51 編集
2018/05/23 14:13 編集
2018/05/23 14:14
2018/05/23 14:27
2018/05/23 15:20
2018/05/23 15:22