简体   繁体   English

带有TableView的导航控制器

[英]Navigation Controller with TableView

I have a UIView which is embedded inside of a NavigationController . 我有一个UIView嵌入在NavigationController When the user clicks on a cell in a TableView he is taken to the UIView . 当用户单击TableView的单元格时,他将被带到UIView However, the UIView pops out from the bottom instead of sliding out from the right side. 但是, UIView从底部弹出而不是从右侧弹出。 I have the segue set to Show , so I am not sure why it is doing this. 我将segue设置为Show ,所以我不确定为什么要这样做。

在此处输入图片说明

The slide-in from the side behavior only works when all of the child navigation controllers are children of the same UINavigationController. 仅当所有子导航控制器都是同一 UINavigationController的子控件时,才能从侧面行为进行滑入。 This requirement includes the "root", or first, child. 此要求包括“根”或第一个孩子。 In your case the root child is the UITableViewController. 在您的情况下,根子级是UITableViewController。

It will look like this in Storyboard: 在Storyboard中将如下所示:

UINavVC ---> RootChildVC ---> SecondChildVC ---> ThirdChildVC etc. UINavVC ---> RootChildVC ---> SecondChildVC ---> ThirdChildVC等

A show segue is contextual. 表演节目是与上下文相关的。 If it is as in the diagram above, it will be a horizontal slide. 如果如上图所示,它将是水平滑动。

In any other situation at all, including a hand-drawn segue between two arbitrary VCs, a show is interpreted as a modal presentation which comes in from the bottom and slides back down. 在任何其他情况下,包括两个任意VC之间的手工绘制序列,一次演出都被解释为一种模式展示 ,从底部进入并向下滑动。 You also don't get the automatic "back" button installation because there is no "navigation" relationship detected. 您也不会自动安装“后退”按钮,因为没有检测到“导航”关系。

You're probably confused and need to re-do your Storyboard into the above simple idiom. 您可能很困惑,需要将故事板重新制作成上述简单的习惯用法。 If you're segueing between "cousins" that is VCs whose direct parents are different UINavigationControllers, they fall under "any other situation". 如果您在“表兄弟”(即直接父级是不同的 UINavigationControllers的VC)之间争论不休,那么它们就属于“任何其他情况”。

A Navigation controller shouldn't be embedded inside another navigation controller. 导航控制器不应嵌入在另一个导航控制器中。
remove root view relationship between View and NavigationController, delete the NavigationController and set "show" segue directly from TableView to that view. 删除View和NavigationController之间的根视图关系,删除NavigationController并将“ show” segue直接从TableView设置为该视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TableView数据传递给其他tableView AND导航控制器 - TableView data pass to other tableView AND navigation controller 使用TableView向视图控制器添加导航 - Adding a Navigation to a View Controller with a TableView TableView Controller +导航控制器+标签栏 - TableView Controller + Navigation Controller + Tab bar TableView 被分配给导航控制器而不是视图控制器 - TableView being assigned to navigation controller not view controller 在导航控制器内的表视图中未调用textFieldDidEndEditing - textFieldDidEndEditing not called in a tableview inside a navigation controller 从tableview看到导航控制器之前的视图 - Segue from tableview to view preceded by navigation controller tableView在推入导航控制器时的奇怪行为 - tableView wierd behaviour while pushing in navigation controller 迅速3秒TableView segue没有显示在导航控制器中 - swift 3 Second TableView segue not showing in Navigation Controller Swift:删除嵌入在导航控制器中的tableview控制器页脚下方的空间 - Swift:remove space below footer of tableview controller embedded in navigation controller 如何在表格视图单元格上按以向视图控制器显示导航控制器中的文本 - How to press on a tableview cell to present a view controller with the text in navigation controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM