我正在开发一个简单的应用程序并以编程方式添加NSAttributedString. 我真的很困惑如何将礼物viewcontroller转移到另一个viewcontroller。
这不是重复的问题,因为我的问题是关于如何移动到查看控制器和重复问题如何在点击时打开链接 如何在 NSAttributedString 中创建可点击的链接?.
截屏

在上图中显示三个NSAttributedString第一个是dhiman.sham1gmail.com,第二个是has started following和第三个Sham。尝试单击时Sham不执行任何操作。单击时,我想将此控制器移动到另一个控制器Sham。
这是我的代码:
@IBOutlet weak var descriptionLbl: UILabel!
override func updateWithModel(_ model: AnyObject) {
self.descriptionLbl.attributedText = self.followingGetTextFromType(data: (model as? FollowingNotificationData)!)
}
func followingGetTextFromType(data:FollowingNotificationData) -> NSMutableAttributedString{
var attributedString = NSMutableAttributedString()
attributedString = NSMutableAttributedString(string:(data.detailsNoti?.fullName)!, attributes: strres)
let startedfollowing = NSMutableAttributedString(string:" has started following ", attributes: attrs)
attributedString.append(startedfollowing)
var discription = NSMutableAttributedString()
if data.fullName == ""{
discription = NSMutableAttributedString(string:"\((data.userName)!)", attributes: strres)
}else{
discription = NSMutableAttributedString(string:"\((data.fullName)!)", attributes: strres)
}
attributedString.append(discription)
}
有人可以向我解释如何解决这个问题,我已经尝试解决这个问题但还没有结果。
任何帮助将不胜感激。
提前致谢。
