简体   繁体   English

在TableViewCell设计上快速加载ViewController

[英]Swift loading ViewController on TableViewCell Design

As I understand it, one of the best ways of handling opening Views upon clicking a particular tableViewCell is by pushing to the ViewController. 据我了解,单击特定tableViewCell时处理打开View的最佳方法之一是推送到ViewController。

However, this apparently only works if you only embed the ViewController in a NavigationController. 但是,这仅在您仅将ViewController嵌入NavigationNavigator中时才有效。

Would you then have to embed each individual ViewController in an Navigation Controller? 然后,您是否必须将每个ViewController嵌入到导航控制器中?

This sounds sort of repetitive and tedious - is this good practice? 这听起来有点重复和乏味-这是好习惯吗?

This tutorial uses navigation controllers on all of the view controllers, but doesn't really say why 本教程在所有视图控制器上使用导航控制器,但并未真正说明原因

I just use one navigation controller, and it works fine for me. 我只使用一个导航控制器,它对我来说很好用。 I've used one and had segues between multiple viewControllers including several tables as well as using buttons in some places, and still been able to navigate super easily. 我已经使用过一个,并且在多个viewController之间进行了搜索,包括多个表以及在某些地方使用按钮,并且仍然能够超级轻松地导航。 In main.storyboard, just select the first view that's going to be a part of it, then go to Editor>Embed In>Navigation Controller. 在main.storyboard中,只需选择将成为其中一部分的第一个视图,然后转到Editor> Embed In> Navigation Controller。 Then, you just add in your segues (I believe they should all be Show(eg Push) segues to work correctly) When running your app, there should be a bar at the top which can be used to go back (you can also edit the bar by adding other buttons or changing the color and title). 然后,您只需添加您的序号(我相信它们都应该是Show(例如Push)序号才能正常工作)在运行您的应用程序时,顶部应该有一个栏可以用来返回(您也可以编辑通过添加其他按钮或更改颜色和标题来添加该栏)。

Here's some documentation from apple 这是苹果一些文件

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

相关问题 TableViewCell到ViewController-Swift - TableViewCell to ViewController - Swift Swift - 在点击 TableViewCell 时打开 ViewController - Swift - Open ViewController on Tapping a TableViewCell 在Swift中从Tableviewcell退出Popover ViewController - Dismiss Popover ViewController from Tableviewcell in Swift 在TableViewCell Swift中从Firebase加载图像 - Loading images from Firebase in TableViewCell Swift Swift Xcode TableViewCell 未第一次加载 - Swift Xcode TableViewCell's Not Loading First Time Swift:触发TableViewCell导致另一个ViewController中的UIWebView中的链接 - Swift: Triggering TableViewCell to lead to a link in a UIWebView in another ViewController Swift:将TableViewCell文本传递到新的ViewController的单元格 - Swift : Pass TableViewCell text to new ViewController's cell 如何从自定义 TableViewCell 转到另一个 ViewController (Swift) - How to Segue from Custom TableViewCell to Another ViewController (Swift) 如何将 tableViewCell 中的 Button 文本打印/传递到 Swift 中的另一个 ViewController? - How to print/pass the text of a Button in a tableViewCell to another ViewController in Swift? 如何在Swift 3.0中将TableViewCell值传递到新的ViewController中? - How to pass TableViewCell value into new ViewController in Swift 3.0?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM