我正在开发一个使用swift语言的IOS应用程序,我希望从uitableview的行转到uitextview以显示一些文本,我想使用uitextview的属性文本属性,但它不起作用。如何做到这一点?
答案 0 :(得分:0)
首先,你不能转向UITextView
;您只能转到另一个视图 controller 。但也许你的意思是说你的segue会进入一个UITextView
的视图控制器。如果是,则控制 - 将segue从表视图单元格拖动到另一个视图控制器,并为segue指定标识符。然后,在表视图控制器中,实现:
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>
}
}
}