I am developing an IOS app using swift language in which I want to segue from uitableview's row to uitextview to show some text and I want to use attributed text property of uitextview but its not working.How to do that?
First of all, you can't segue to a UITextView
; you can segue only to another view controller. But maybe you meant to say that your segue goes to a view controller with a UITextView
in it. If so, then control-drag a segue from your table view cell to the other view controller, and give the segue an identifier. Then, in your table view controller, implement:
func prepareForSegue(_ segue: UIStoryboardSegue, sender sender: AnyObject?) {
if segue.identifier == "the-segue-id-that-you-put-in-your-storyboard" {
// Cast your destination view controller to the specific type
if let destinationVC = segue.destination as? <your-view-controller-type> {
destinationVC.textView.attributedText = <your-string>
}
}
}