【问题标题】:Navigation and Tab bar disappear with Push Segue导航和标签栏随着 Push Segue 消失
【发布时间】:2016-04-10 02:01:02
【问题描述】:

我正在开发一个 swift 应用程序,它有一个标签栏控制器,其中一个标签有一个导航控制器。带有导航控制器的选项卡有一个表格视图,表格视图中的单元格连接到一个常规的视图控制器。信息根据需要出现在目标视图控制器中,当目标视图控制器出现时,标签栏和导航栏都会消失。

这是我的 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")
            }
        }
    }

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

【问题讨论】:

    标签: swift uitableview uinavigationcontroller uitabbarcontroller segue


    【解决方案1】:

    导航栏和标签栏消失,因为您正在使用模型segue。

    更改 segue 以推送显示。

    在模型中,目标 ViewController 出现在当前 viewController 的顶部。 所以目标视图控制器对您的导航堆栈或标签栏一无所知。

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

    【讨论】:

    猜你喜欢
    • 2016-02-04
    • 2016-05-04
    • 2013-12-02
    • 2013-03-19
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    • 2018-01-07
    • 1970-01-01
    相关资源
    最近更新 更多