<tfoot id='lfteU'></tfoot>

      <i id='lfteU'><tr id='lfteU'><dt id='lfteU'><q id='lfteU'><span id='lfteU'><b id='lfteU'><form id='lfteU'><ins id='lfteU'></ins><ul id='lfteU'></ul><sub id='lfteU'></sub></form><legend id='lfteU'></legend><bdo id='lfteU'><pre id='lfteU'><center id='lfteU'></center></pre></bdo></b><th id='lfteU'></th></span></q></dt></tr></i><div id='lfteU'><tfoot id='lfteU'></tfoot><dl id='lfteU'><fieldset id='lfteU'></fieldset></dl></div>

        <legend id='lfteU'><style id='lfteU'><dir id='lfteU'><q id='lfteU'></q></dir></style></legend>

      1. <small id='lfteU'></small><noframes id='lfteU'>

        • <bdo id='lfteU'></bdo><ul id='lfteU'></ul>
      2. 以编程方式从一个 ViewController 导航到 didSelectRowAt 上的另一个

        Navigate from a ViewController to an another on didSelectRowAt programmatically(以编程方式从一个 ViewController 导航到 didSelectRowAt 上的另一个)
        <legend id='Mwx8K'><style id='Mwx8K'><dir id='Mwx8K'><q id='Mwx8K'></q></dir></style></legend>

        <small id='Mwx8K'></small><noframes id='Mwx8K'>

          <i id='Mwx8K'><tr id='Mwx8K'><dt id='Mwx8K'><q id='Mwx8K'><span id='Mwx8K'><b id='Mwx8K'><form id='Mwx8K'><ins id='Mwx8K'></ins><ul id='Mwx8K'></ul><sub id='Mwx8K'></sub></form><legend id='Mwx8K'></legend><bdo id='Mwx8K'><pre id='Mwx8K'><center id='Mwx8K'></center></pre></bdo></b><th id='Mwx8K'></th></span></q></dt></tr></i><div id='Mwx8K'><tfoot id='Mwx8K'></tfoot><dl id='Mwx8K'><fieldset id='Mwx8K'></fieldset></dl></div>
          • <bdo id='Mwx8K'></bdo><ul id='Mwx8K'></ul>
              <tbody id='Mwx8K'></tbody>

              <tfoot id='Mwx8K'></tfoot>

                1. 本文介绍了以编程方式从一个 ViewController 导航到 didSelectRowAt 上的另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个包含自定义 UITableViewUIViewController.该表也有一个自定义 UITableViewCell.

                  I have a UIViewController that contains a custom UITableView. The table has a custom UITableViewCell too.

                  当您选择/单击其中一行时,如何从第一个 ViewController 导航到另一个?

                  How to navigate from the first ViewController to an another when you select/click one of the rows?

                  我没有使用过 StoryBoard.

                  这是我的代码.每个类都是外部文件.如果您需要更多代码,请告诉我.

                  This my code. Each one of the classes are external file. Let me know, if you need more code.

                  class TestViewController: UIViewController, UITableViewDelegate {
                  
                      override func viewDidLoad() {
                          super.viewDidLoad()
                          view.backgroundColor = .white
                          view.addSubview(testTableView)
                      }
                  
                      let testTableView: TestTableView = {
                          let table = TestTableView()
                          table.register(TestTableViewCell.self, forCellReuseIdentifier: TestTableViewCell.identifier)
                          return table
                      }()
                  }
                  
                  class TestTableView: UITableView,  UITableViewDelegate, UITableViewDataSource {
                      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                          return 1
                      }
                  
                      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                         let cell = tableView.dequeueReusableCell(withIdentifier: TestTableViewCell.identifier, for: indexPath)
                          return cell
                      }
                  }
                  
                  
                  
                  class TestTableViewCell: UITableViewCell {
                      static let identifier  = "testCell"
                  }
                  

                  推荐答案

                  这里有一个完整的答案:

                  Here is a complete answer:

                  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
                      let newViewController = NewViewController()
                      self.navigationController?.pushViewController(newViewController, animated: true)
                  }
                  

                  这篇关于以编程方式从一个 ViewController 导航到 didSelectRowAt 上的另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  View being blocked by UITransitionView after being presented(呈现后被 UITransitionView 阻止的视图)
                  Show UITabBar when UIViewController pushed(推送 UIViewController 时显示 UITabBar)
                  Instagram-like navigation bar (iOS 7)(类似 Instagram 的导航栏 (iOS 7))
                  Pass data through navigation back button(通过导航返回按钮传递数据)

                  • <legend id='dxRGZ'><style id='dxRGZ'><dir id='dxRGZ'><q id='dxRGZ'></q></dir></style></legend>

                  • <small id='dxRGZ'></small><noframes id='dxRGZ'>

                      <i id='dxRGZ'><tr id='dxRGZ'><dt id='dxRGZ'><q id='dxRGZ'><span id='dxRGZ'><b id='dxRGZ'><form id='dxRGZ'><ins id='dxRGZ'></ins><ul id='dxRGZ'></ul><sub id='dxRGZ'></sub></form><legend id='dxRGZ'></legend><bdo id='dxRGZ'><pre id='dxRGZ'><center id='dxRGZ'></center></pre></bdo></b><th id='dxRGZ'></th></span></q></dt></tr></i><div id='dxRGZ'><tfoot id='dxRGZ'></tfoot><dl id='dxRGZ'><fieldset id='dxRGZ'></fieldset></dl></div>
                        <bdo id='dxRGZ'></bdo><ul id='dxRGZ'></ul>
                      • <tfoot id='dxRGZ'></tfoot>

                              <tbody id='dxRGZ'></tbody>