我有一个 UITableViewController
,其标签位于 Storyboard的单元格中。我想在下一个 Controller 的标题中显示所选单元格标签的标题。如何显示标题?
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 8
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.destination is ViewController) {
//code to showing title of my cell
}
}
最佳答案
您只需在 if 语句中获取目标 ViewController,如下所示:
//get destination view an set the title
let vc=segue.destination
//set title
vc.title="My Title"
关于ios - 如何使用 segue 在下一个 Controller 中显示单元格标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43983626/