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

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

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

      1. 如何从 UIView 的子类推送视图控制器

        时间:2023-06-12

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

          <legend id='AN4Gs'><style id='AN4Gs'><dir id='AN4Gs'><q id='AN4Gs'></q></dir></style></legend>
          <tfoot id='AN4Gs'></tfoot>

            <i id='AN4Gs'><tr id='AN4Gs'><dt id='AN4Gs'><q id='AN4Gs'><span id='AN4Gs'><b id='AN4Gs'><form id='AN4Gs'><ins id='AN4Gs'></ins><ul id='AN4Gs'></ul><sub id='AN4Gs'></sub></form><legend id='AN4Gs'></legend><bdo id='AN4Gs'><pre id='AN4Gs'><center id='AN4Gs'></center></pre></bdo></b><th id='AN4Gs'></th></span></q></dt></tr></i><div id='AN4Gs'><tfoot id='AN4Gs'></tfoot><dl id='AN4Gs'><fieldset id='AN4Gs'></fieldset></dl></div>
              <bdo id='AN4Gs'></bdo><ul id='AN4Gs'></ul>
                    <tbody id='AN4Gs'></tbody>
                  本文介绍了如何从 UIView 的子类推送视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了一个视图CategoryTableView",它是 UIView 的子类.而CategoryTableView 包含一个UITableView.我将 CategoryTableView 作为子视图添加到来自 UIViewController 的子类 HomeViewController.现在,我想在 didSelectRowAtIndexPath 执行时推送一个新的视图控制器.但是,在 CategoryTableView 中,我如何推送或呈现另一个视图控制器.我无法进入 CategoryTableView 中的导航控制器.

                  I created a view "CategoryTableView" that subclass from UIView. And CategoryTableView contains a UITableView. I added CategoryTableView as a subview to HomeViewController that subclass from UIViewController. Right now, I want to push a new view controller when didSelectRowAtIndexPath executes. But, in CategoryTableView, how do I push or present another view controller. I can't get to the navigation controller in CategoryTableView.

                  推荐答案

                  CategoryTableView.h

                  @property (retain, nonatomic) parentViewController *parent; //create one property for parent view like this
                  

                  CategoryTableView.m

                  @sythesize parent;
                  
                  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
                  {
                      [parent.navigationController . . .]; // preform action
                      //OR..
                      [parent presentModalViewController: . . .]; // present modal view
                  }
                  

                  parent.m

                  //while calling your CategoryTableView assign self to your parent object
                  
                      CategoryTableView *tblView = [CategoryTableView alloc] init];
                      tblView.parent = self;
                  

                  这篇关于如何从 UIView 的子类推送视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:为什么我的根视图的高度不考虑它的导航栏? 下一篇:self.navigationController.tabBarController.selectedIndex 不起作

                  相关文章

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

                      <bdo id='X9M4N'></bdo><ul id='X9M4N'></ul>
                    1. <tfoot id='X9M4N'></tfoot>
                    2. <legend id='X9M4N'><style id='X9M4N'><dir id='X9M4N'><q id='X9M4N'></q></dir></style></legend>

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