[英]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.