gpt4 book ai didi

ios - 添加了导航栏但没有返回按钮?

转载 作者:IT王子 更新时间:2023-10-29 05:29:57 24 4
gpt4 key购买 nike

我创建了一个 TableView ,假设用户按下了一个单元格,它将转到 detailItemView,但现在唯一的问题是,无论何时用户在 detailItemView 中,都没有后退按钮,即使我已经嵌入了一个导航 Controller

这是在用户按下单元格后将执行 segue 的代码:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

// Get the new view controller using [segue destinationViewController].
var nav = segue.destinationViewController as! UINavigationController
var detailScene = nav.topViewController as! DetailViewController


// Pass the selected object to the destination view controller.
if let indexPath = self.tableView.indexPathForSelectedRow() {
let row = Int(indexPath.row)
detailScene.currentObject = objects?[row] as? PFObject
}
}

Storyboard的屏幕截图:

enter image description here

编辑截图

enter image description here

我试着做了下面的答案,但仍然没有后退按钮

另一个截图,detailView Controller 没有后退按钮

enter image description here

最佳答案

将 TableViewController 嵌入到 NavigationController 中。不是直接的 DetailViewController。查看屏幕截图。

确保连接 TableViewController 和 DetailViewController 的 segue 类型为Show(例如 Push)。你必须从字面上看 push Navigationstack 顶部的新 View 。

Check screenshot

关于ios - 添加了导航栏但没有返回按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30326680/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com