gpt4 book ai didi

swift - 导航和标签栏随着 Push Segue 消失

转载 作者:行者123 更新时间:2023-11-30 10:08:32 25 4
gpt4 key购买 nike

我正在开发一个快速应用程序,它有一个选项卡栏 Controller ,其中一个选项卡有一个导航 Controller 。带有导航 Controller 的选项卡有一个 TableView , TableView 中的单元格连接到常规 View Controller 。信息根据需要显示在目标 View Controller 中,当呈现目标 View Controller 时,选项卡栏和导航栏都会消失。

这是我的prepareForSegue:

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "entryCellToEntryView" {
if let destination = segue.destinationViewController as? EntryDetailViewController {
if let index = customTableView.indexPathForSelectedRow {
if let cell = customTableView.cellForRowAtIndexPath(index) as? EntryTableViewCell {
destination.entryToDisplay = cell.entry
} else {
print("prepareForSeque: Unable to cast cell as EntryTableViewCell")
}
} else {
print("prepareForSeque: Index cannot be established")
}
} else {
print("prepareForSeque: Destination cannot be downcast to EntryDetailViewController")
}
}
}

这是我的 Storyboard照片的链接: http://grantbroadwater.com/storyboard.png

最佳答案

导航栏和选项卡栏消失,因为您正在使用模型转场。

将显示的segue更改为push are show。

在模型segue中,目标ViewController出现在当前viewController的顶部。因此,目标 View Controller 对您的导航堆栈或选项卡栏一无所知。

如果你使用push segue,或者现在显示segue,那么只有它会被插入导航堆栈。

关于swift - 导航和标签栏随着 Push Segue 消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34625344/

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