I Have a custom cell that has a UITextView called StatusText. I have an extension that finds all @ signs in the textView and turns it into a link. I want to be able to click that username link and go to the profile view controller.
Here is the following code of the CustomCell:
import UIKit
class profileCell: UITableViewCell, UITextViewDelegate {
@IBOutlet weak var UserImage: UIImageView!
@IBOutlet weak var UserName: UILabel!
@IBOutlet weak var Time: UILabel!
@IBOutlet weak var Likes: UILabel!
@IBOutlet weak var Dislikes: UILabel!
@IBOutlet weak var StatusText: UITextView!
@IBOutlet weak var LikeButton: UIButton!
@IBOutlet weak var DislikeButton: UIButton!
override func awakeFromNib() {
StatusText.delegate = self
}
func StatusText(StatusText: UITextView, shouldInteractWithURL URL: NSURL, inRange characterRange: NSRange) -> Bool {
/* perform your own custom actions here */
print("firing this right now")
return true // return true if you still want UIAlertController to pop up
}
}