Как сделать segue переход с TableViewController на UISplitviewcontroller, в котором TableViewController?
Можно модальный переход сделать, но тогда не лезя вернуться назад с UISplitviewcontroller на TableViewController, а это нужно.
Пробовал вот так:
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let indexPath = tableView.indexPathForSelectedRow
let vc = self.storyboard?.instantiateViewController(withIdentifier: "TableViewController") as! TableViewController
vc.nameDetail = monsters[indexPath!.row].name
splitViewController?.show(vc, sender: self)
}
И так
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let indexPath = tableView.indexPathForSelectedRow
let vc = self.storyboard?.instantiateViewController(withIdentifier: "TableViewController") as! TableViewController
vc.nameDetail = monsters[indexPath!.row].name
self.navigationController?.pushViewController(vc, animated: true)
let controller = (segue.destination as! UINavigationController).topViewController as! TableViewController
if segue.identifier == "showDetail" {
if let indexPath = tableView.indexPathForSelectedRow {
let controller = (segue.destination as! UINavigationController).topViewController as! TableViewController
controller.nameDetail = monsters[indexPath.row].name
controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
controller.navigationItem.leftItemsSupplementBackButton = true
controller.navigationItem.setHidesBackButton(false, animated: true)
}
}
}